Hi,
since some time I have some problems with my rule execution.
The rules it self are working as expected, but after some time they are not performed any longer until I “touch” or edit them and OH is refreshing the rule.
I was running openHAB 2.2.0 Release Build on a raspberry 2B, but also on 2.3.0 I have the same Problem.
… maybe its the Hardfware so I changed to a Laptop with latest Debian OS and restored my config.
Any suggestions if there is a better way to debug than just set “log:set DEBUG” and dont be flooded with messages?
This is one of the affected rule:
rule "sz_r"
when
Item sz_r_sw changed
then
if (sz_r_sw.state == "0") {
sz_r.sendCommand(0) }
else if (sz_r_sw.state == "1") {
sz_r.sendCommand(65) }
else if (sz_r_sw.state == "2") {
sz_r.sendCommand(80) }
else if (sz_r_sw.state == "3") {
sz_r.sendCommand(100) }
end
ok, new start.
I was NOT posting my Items because I dont think there is any problam with it.
The rule itself IS WORKING, but after some time it is no longer working.
Also there is just nothing relevant in the log except “Item sz_r_sw changed to x”
therefore I asked for the recomended debug settings.
You can also set the log to TRACE, maybe that will provide additional info to help resolve your issue. Can’t do much about the flooding messages though, just hope you get what’s needed quick so it can be turned off.
I answered your post because I want to help you.
Your post didn’t have any information apart from your badly formatted rule.
So I (politely) asked for more info.
If you are going to have that attitude with volunteers who give their free time to help, go on twitter or facebook.
Ty, I really appreciate ANY help. I was hoping that there is a specific trace for this case (like enabling traces for bindings)
@vzorglub I will add my Items / Log in the first Post.
Only This rule stoped working others are doing fine, and after I edit the rule and the file is refreshed the rule is working again.
I have one rule in place with “createTimer(now.plusSeconds(20)” but even if I delete this rule the problem stays.
I dont habe any problems with helpful people but in EVERY forum the first post to noobs is… read rules, did u searched. do this and this.
Of course I did perform a search…
And of course I did read the rules.
My intention was to ask for the best TRACE / DEBUG for this because in the Logs is just nothing. But I will post my log.
There is nothing in the Rule itself that looks like it would cause a problem.
Add some logInfo statements to the Rule. Importantly make the first line of the Rule be a logInfo and then watch both events.log and openhab.log and make sure that every time sz_r_sw changes state your see at least that first log statement.
Also add an else with a logWarn or logError in case sz_r_sw.state isn’t one of the indicated options.
All of this is to figure out whether indeed the Rule isn’t triggering, or whether the Rule is triggering but not doing anything because sz_r_sw is not in an expected state.
Finally, because I can’t help myself, the code would be easier to read if you use a switch:
logInfo("Rollershutter", "About to process a new sz_r_sw.state")
var rsVal = 0
switch(sz_r_sw.state) {
case "0": rsVal = 0
case "1": rsVal = 65
case "2": rsVal = 80
case "3": rsVal = 100
default: {
logError("Rollershutter", "Unexpected value for sz_r_sw: " + sz_r_sw.state)
return;
}
}
sz_r.sendCommand(rsVal)
@rlkoshak Will try both of your suggestions, I was not aware that your way is also possible, Much easier.
Maybe tomorrow or sunday I will have the issue again.