Hi all,
I am having trouble getting a rule to trigger with mqtt.
My setup:
*Mosquito running on Raspberry Pi
*Openhab 2.5.0 Build #1589 running on Windows
*I have a generic mqtt thing with multiple channels receiving the mqtt commands.
*Switch items linked to the thing channels.
*Rule set to change a separate item switch based on the state of one of the mqtt controlled switches.
If I manually operate the first switch the second will follow as I have set in the rule but if the first switch is operated by mqtt the second will not follow. What am I missing? Is there a difference in how an item state is updated between mqtt and manual operation?
Config files below.
.things
Bridge mqtt:broker:myUnsecureBroker [ host="192.168.1.107", secure=false ]
{
Thing mqtt:topic:secritySystem {
Channels:
Type switch : arm_Away "Alarm System Away" [ stateTopic="home/security/bosch_away", commandTopic="", on="1", off="0" ]
Type switch : arm_Home "Alarm System Home" [ stateTopic="home/security/bosch_home", commandTopic="", on="1", off="0" ]
Type switch : arm_Trigger "Alarm System Trigger" [ stateTopic="home/security/bosch_trigger", commandTopic="", on="1", off="0" ]
Type switch : sirens "Internal Sirens" [ stateTopic="", commandTopic="home/security/sirens", on="1", off="0" ]
Type switch : sirens_Test "Internal Sirens Test" [ stateTopic="", commandTopic="home/security/sirens_test", on="1", off="0" ]
}
}
.items
Switch Security_Away "Security Away Status" {channel="mqtt:topic:secritySystem:arm_Away"}
Switch Security_Home "Security Home Status" {channel="mqtt:topic:secritySystem:arm_Home"}
Switch Security_Trigger "Security Trigger Status" {channel="mqtt:topic:secritySystem:arm_Trigger"}
Switch Security_Sirens "Security Sirens" {channel="mqtt:topic:secritySystem:sirens"}
Switch Security_Sirens_Test "Security Sirens Test" {channel="mqtt:topic:secritySystem:sirens_Test"}
.rules
rule "Security alrams trigger"
when
Item Security_Away received command
then
if (receivedCommand == ON) {
Security_Sirens.sendCommand(ON)
}
else if (receivedCommand == OFF) {
Security_Sirens.sendCommand(OFF)
}
end
I have also tried a very basic rule to see if it was triggering at all but this didn’t work either.
rule "Security alrams trigger"
when
Item Security_Away received command
then
Security_Sirens.sendCommand(ON)
end