update rules / items / things to better reflect project + naming conv.
This commit is contained in:
parent
07cfe658cc
commit
62e0ced2a4
3 changed files with 51 additions and 13 deletions
|
@ -4,7 +4,7 @@ Group SmartClothes
|
||||||
Group Sensors
|
Group Sensors
|
||||||
Group:Number Cam "Last roll" (Sensors)
|
Group:Number Cam "Last roll" (Sensors)
|
||||||
|
|
||||||
Group Actuators
|
Group Actuators
|
||||||
Group Lights (Actuators)
|
Group Lights (Actuators)
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,12 +12,11 @@ Number dmg "dernier degat" (Cam, Sensors){
|
||||||
channel="Channel='mqtt:topic:de'"
|
channel="Channel='mqtt:topic:de'"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Switch animation_toggle "toggle animation degat" (Lights){
|
||||||
Switch animation "lampe animation degat" (Lights){
|
|
||||||
channel="Channel='mqtt:topic:lumiere'"
|
channel="Channel='mqtt:topic:lumiere'"
|
||||||
}
|
}
|
||||||
|
|
||||||
Color couleur "couleur lampe" (Lights){
|
String animation "animation degat" (Lights){
|
||||||
channel="Channel='mqtt:topic:lumiere'"
|
channel="Channel='mqtt:topic:lumiere'"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
42
openhab/openhab_conf/rules/battlefield.rules
Normal file
42
openhab/openhab_conf/rules/battlefield.rules
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
import org.eclipse.smarthome.model.script.ScriptServiceUtil
|
||||||
|
// import org.eclipse.smarthome.core.library.items.StringItem
|
||||||
|
|
||||||
|
val mqttActions = getActions("mqtt", "mqtt:broker:mainBroker")
|
||||||
|
val TAG_FileName = "battlefield.rules"
|
||||||
|
|
||||||
|
|
||||||
|
rule "Démarrage de openHAB"
|
||||||
|
when
|
||||||
|
System started
|
||||||
|
then
|
||||||
|
logInfo(TAG_FileName, "Rule : Démarrage de openHAB")
|
||||||
|
// il n'y a personne dans la pièce et l'éclairage est fermé
|
||||||
|
mqttActions = getActions("mqtt", "mqtt:broker:mainBroker")
|
||||||
|
|
||||||
|
animation_toggle.sendCommand(ON)
|
||||||
|
end
|
||||||
|
|
||||||
|
rule "light toggle"
|
||||||
|
when
|
||||||
|
Item animation_toggle received command
|
||||||
|
then
|
||||||
|
logInfo(TAG_FileName, "Rule : mqtt evts")
|
||||||
|
logInfo(TAG_FileName, "item animation_toggle changed to " +
|
||||||
|
animation_toggle.state)
|
||||||
|
|
||||||
|
mqttActions.publishMQTT("lumiere/degat/toggle",
|
||||||
|
animation_toggle.state.toString(), false)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
rule "light animation"
|
||||||
|
when
|
||||||
|
Item animation received command
|
||||||
|
then
|
||||||
|
logInfo(TAG_FileName, "Rule : mqtt evts")
|
||||||
|
logInfo(TAG_FileName, "item animation changed to " +
|
||||||
|
animation.state)
|
||||||
|
|
||||||
|
mqttActions.publishMQTT("lumiere/degat/animation",
|
||||||
|
animation.state.toString(), false)
|
||||||
|
end
|
|
@ -3,27 +3,24 @@ Bridge mqtt:broker:mainBroker [ host="172.69.1.2", secure=false ]
|
||||||
|
|
||||||
Thing mqtt:topic:lumiere "lumiere" (mqtt:broker:mainBroker) {
|
Thing mqtt:topic:lumiere "lumiere" (mqtt:broker:mainBroker) {
|
||||||
Channels:
|
Channels:
|
||||||
Type switch : light "indicateur degat" [
|
Type string : light "indicateur degat animation" [
|
||||||
stateTopic="lumiere/degat/etat",
|
stateTopic="lumiere/degat/animation"
|
||||||
commandTopic="lumiere/degat/commande",
|
|
||||||
on="ON", off="OFF"
|
|
||||||
]
|
]
|
||||||
Type color : light "effect color" [
|
Type switch : light_toggle "indicateur degat toggle" [
|
||||||
stateTopic="lumiere/degat/color/etat",
|
stateTopic="lumiere/degat/toggle"
|
||||||
commandTopic="lumiere/degat/color/commande", colorMode="RGB"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
Thing mqtt:topic:de "lecteur de" (mqtt:broker:mainBroker) {
|
Thing mqtt:topic:de "lecteur de" (mqtt:broker:mainBroker) {
|
||||||
Channels:
|
Channels:
|
||||||
Type number : de "effecteur degat" [
|
Type number : de "effecteur degat" [
|
||||||
stateTopic="de/degat/dernierLance"
|
stateTopic="capteur/de/degat/dernierLance"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
Thing mqtt:topic:button "recommencer" (mqtt:broker:mainBroker) {
|
Thing mqtt:topic:button "recommencer" (mqtt:broker:mainBroker) {
|
||||||
Channels:
|
Channels:
|
||||||
Type switch : de "effecteur nouveau tour" [
|
Type switch : de "effecteur nouveau tour" [
|
||||||
stateTopic="de/nouveauTour"
|
stateTopic="capteur/boutton/nouveauTour"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue