I have (again) maybe a simple Problem. I have one rule that hast to possible triggers, which are adressed in the when statement …
when Item HueSensMotion2 changed to ON or
Item LCN_WC_Relay_HUE_WC_Switch changed from ON
then { ...
So after triggering this rule the lights will go on and a timer will start to switch off the light after a defined time. When motion is detected again, the timer will be retriggered and will start again. This still works fine.
Now I want to switch off the light, when it is on and the relay close again. For this purpose I need to decide which event has triggered the rule … but, and this is the problem … I don’t know kow …
If there is a simple way to solve this problem, I would be happy to hear about.
triggeringItem.name is what you are looking for. See this example of mine:
rule "Zeit des Offline-Gehens einer Bridge"
when
Item Netzwerk_Bettlampe_Online changed to OFF or
Item Netzwerk_BrennstuhlBridge_Online changed to OFF or
Item Netzwerk_TadoBridge_Online changed to OFF
then
logInfo("Rule triggered", Dateiname + ": \"Zeit des Offline-Gehens einer Bridge\": " + triggeringItem.name.replace("_Online", "").replace("Netzwerk_", ""))
triggeringItem.name.replace("Online", "OfflineSeit").sendCommand(now.toString)
end