my openHAB (latest build but issue occurs longer) is running very well but i have an annoying issue with a quit simple rule:
I have an switch (Homematic) which i am using to enable “away” mode. The rule looks like this:
rule "Anwesenheit 1"
when
Item Flur_Schalter_2_short changed to ON or
Item Flur_Schalter_2_long changed to ON
then
logInfo("Flur", "Schalter 2 Flur wurde betätigt")
logInfo("Flur", "setze ABWESEND")
sendCommand(Abwesend,ON)
logInfo("Flur", "Abwesend ist jetzt "+Abwesend.state)
end
rule "Anwesenheit 2"
when
Item Flur_Schalter_1_short changed to ON or
Item Flur_Schalter_1_long changed to ON
then
logInfo("Flur", "Schalter 1 Flur wurde betätigt")
logInfo("Flur", "setze ANWESEND")
sendCommand(Abwesend,OFF)
logInfo("Flur", "Abwesend ist jetzt "+Abwesend.state)
end
But most of the time (not always) when i push the button the item “Abwesend” is not updating. Here a log view:
2016-11-26 18:36:58.628 [INFO ] [.eclipse.smarthome.model.script.Flur] - Schalter 2 Flur wurde betätigt
2016-11-26 18:36:58.628 [INFO ] [.eclipse.smarthome.model.script.Flur] - setze ABWESEND
2016-11-26 18:36:58.629 [INFO ] [.eclipse.smarthome.model.script.Flur] - Abwesend ist jetzt OFF
As you can see the item is still “OFF”, and other rules wich are looking for changes of that item are not triggered. BUT short time after this the item seems to be updated but in some kind of “stealth mode” because rules looking for a state change still not being triggered. There is a cron based rule which is looking for the state in the code an this one does what it should be, and when i query the item state on CLI it shows “ON”.
i have changed to Abwesend.sendCommand(ON) with the same outcome. But i realised that althought the output of Abwesend.state to the log the Item IS being updated. The problem seems to be more that another rule (which should be triggered) does not respond if the state of “Abwesend” is changed in this way. If i change it via the OpenHAB app everything works as it should.
the rule triggered by Flur_Schalter_1_short is working fine. There is another rule that should be triggered when “Anwesend” has been changed:
rule "Anwesenheit 2"
when
Item Abwesend changed to ON
then
logInfo("Abwesenheit", "Abwesend is aktiv")
// blablabla
end
That one does not get triggered if “Anwesend” is changed by the other rule mentioned above. If i change “Anwesend” directly with the app it works. I will try and use “received command” to look if it makes any difference
rule "Anwesenheit 2"
when
Item Abwesend received command ON
then
logInfo("Abwesenheit", "Abwesend is aktiv")
sendTelegram("bot1", "Modus ist jetzt abwesend.")
notifyMyAndroid("Präsenz","Modus ist jetzt abwesend.")
end
is still not working.
BUT:
rule "Anwesenheit 3"
when
Item Abwesend changed to OFF
then
logInfo("Abwesenheit", "Abwesend is inaktiv")
sendTelegram("bot1", "Modus ist jetzt anwesend.")
notifyMyAndroid("Präsenz","Modus ist jetzt anwesend.")
end
If your correctly triggered rule does sendCommand(Abwesend,ON) , then another rule should trigger on Item Abwesend received command ON, provided that there is a Switch item named Abwesend.
If you create a minimal configuration with as few pieces as possible that demonstrates the problem, that and your openHAB version should be enough to go into an issue here.
The problem was (and i run into it at least twice since now that i named multiple rules the same. There where two “Anwesenheit 2” and in that case there is no error but it simply causes unpredictable results.