I have a rule with two items with received update.
How can I get the current state of the triggered item or the triggered item itself in the “then”?
For example:
rule “test”
when
Item LivingRoom_CO2_Netatmo received update or
Item Office_CO2_Netatmo received update
then get the state of the triggered item (LivingRoom_CO2_Netatmo or Office_CO2_Netatmo)
MDAR
(Stuart Hanlon, UK importer of Velbus hardware)
3
Hi
Just to be clear…
Can the triggeringItem.state be used when the trigger is a Channel instead of an Item?
For example, a button event of a Velbus Glass Panel Thing?
rule "map cooler channel"
when
Channel "velbus:vmbgp2:c5053467:1C:thermostat#COOLER" triggered
then
if (triggeringItem.state == "pressed") {
AirCon.sendCommand(ON)
}
if (triggeringItem.state == "released") {
AirCon.sendCommand(OFF)
}
end
MDAR
(Stuart Hanlon, UK importer of Velbus hardware)
7
Thanks
I’ll look into that tomorrow and see what I can come up with.
It certainly looks like it’s perfect.
This is what I love about openHAB2, there is always something extra to be discovered
MDAR
(Stuart Hanlon, UK importer of Velbus hardware)
8
Hi,
This is the rule I’m going to try.
As Rich advises, it’s better to reduce the repeats.
rule "map cooler channel" when
Channel "velbus:vmbgp2:c5053467:1C:thermostat#COOLER" triggered
then
if (receivedEvent.Event.toString == "pressed") { AirCon.sendCommand(ON) }
if (receivedEvent.Event.toString == "released") { AirCon.sendCommand(OFF) }
end