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
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
|
Loading…
Add table
Add a link
Reference in a new issue