ggriesse
(Ggriesse)
November 28, 2017, 7:19pm
1
OpenHabianPI 2.1
im trying to get a rule to fire when receiving a specific keyword from MQTT , it works for ON/OFF but not for “other words”
I have a rule working as below - two rules one for ON and one for OFF - both work perfectly
rule "Switch Change ON"
when
Item TestZone1 received command ON
then
pushover("TestZone1 ON ")
BUT this one doesn’t work !!! , i have tried received update and Received Command … both don’t work
rule "Sensor Is Online"
when
Item TestZone1 received update HELLO
then
pushover(“Sensor Came Online”)
end
Any ideas ?
rgerrans
(Rgerrans)
November 28, 2017, 9:05pm
2
Move your word check out of the when statement (I would suggest using a case check), so it would look more like:
rule "Zone Status"
when
item TestZone1 received command
then
switch TestZone1.state {
case "ON" : pushover("TestZone1 ON ")
case "HELLO" : pushover(“Sensor Came Online”)
}
end
ggriesse
(Ggriesse)
November 29, 2017, 8:12am
3
Not working BUT i think my issue may lie with the ITEMS file ??
current item file has the “device” listed as a Contact
Contact testZone1 “Kitchen Door” { mqtt="<[broker:Greg-SmartHouse/garage/TestZone1:state:default]" }
if i read the docs it says that contact only supports OPEN/CLOSED
what do i use or add to get it to accept variables such as HELLO as well as OPEN / ClOSED ?
rgerrans
(Rgerrans)
November 29, 2017, 12:16pm
4
That would do it and explain why it only accepted on/off. Change it to a String type
String testZone1 “Kitchen Door” { mqtt="<[broker:Greg-SmartHouse/garage/TestZone1:state:default]" }
ggriesse
(Ggriesse)
November 29, 2017, 12:42pm
5
Magic ! it works , Thanks