update rules / items / things to better reflect project + naming conv.

This commit is contained in:
theBigBlase 2023-12-21 12:08:36 -05:00
parent 07cfe658cc
commit 62e0ced2a4
3 changed files with 51 additions and 13 deletions

View file

@ -12,12 +12,11 @@ Number dmg "dernier degat" (Cam, Sensors){
channel="Channel='mqtt:topic:de'"
}
Switch animation "lampe animation degat" (Lights){
Switch animation_toggle "toggle animation degat" (Lights){
channel="Channel='mqtt:topic:lumiere'"
}
Color couleur "couleur lampe" (Lights){
String animation "animation degat" (Lights){
channel="Channel='mqtt:topic:lumiere'"
}

View 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

View file

@ -3,27 +3,24 @@ Bridge mqtt:broker:mainBroker [ host="172.69.1.2", secure=false ]
Thing mqtt:topic:lumiere "lumiere" (mqtt:broker:mainBroker) {
Channels:
Type switch : light "indicateur degat" [
stateTopic="lumiere/degat/etat",
commandTopic="lumiere/degat/commande",
on="ON", off="OFF"
Type string : light "indicateur degat animation" [
stateTopic="lumiere/degat/animation"
]
Type color : light "effect color" [
stateTopic="lumiere/degat/color/etat",
commandTopic="lumiere/degat/color/commande", colorMode="RGB"
Type switch : light_toggle "indicateur degat toggle" [
stateTopic="lumiere/degat/toggle"
]
}
Thing mqtt:topic:de "lecteur de" (mqtt:broker:mainBroker) {
Channels:
Type number : de "effecteur degat" [
stateTopic="de/degat/dernierLance"
stateTopic="capteur/de/degat/dernierLance"
]
}
Thing mqtt:topic:button "recommencer" (mqtt:broker:mainBroker) {
Channels:
Type switch : de "effecteur nouveau tour" [
stateTopic="de/nouveauTour"
stateTopic="capteur/boutton/nouveauTour"
]
}