Hi,
I’m having a serious problem with my rulesets, and I don’t know where to start debugging. I monitor this for months now and hope some of you can give me an idea how to overcome…
I have several rulesets based on case
and switch
. For my hue bulbs or my rollershutters par example. So in my sitemap I have entries like these:
Selection item=Rollladen_Szene
label="Szenen"
icon="sofa"
mappings=[0="Wähle",
1="Alle auf",
2="Sonnenschutz",
3="Alle zu"]
Rollladen_Szene
, of course, is an item of type number. In my rules file, I take Rollladen_Szene
and do the switch:
rule "Rollladen Szene"
when
Item Rollladen_Szene received command
then
logInfo("Rollladen", "Gesendet: " +Rollladen_Szene.state)
switch(Rollladen_Szene.state) {
case 1: {
...
}
case 2: {
...
}
case 3: {
...
}
Rollladen_Szene.postUpdate(0)
end
So what’s my problem? I choose - browser or app, makes no difference - one of the cases, and the possibility the rollershutters change is about 60 to 40. I added logInfo
statements after then, so I can see:
- yes, OH2 enters my rule and
- yes, it’s about to be executed and
-
yes,
Rollladen_Szene
is recognized the right way.
But - many times nothing happens. Even I get my log output that Rollladen_Szene
is recognized as let’s say 2
, the case 2: {...}
statement is often not entered.
It would be much easier when it would never work - but that’s not the case. Sometimes everything is fine, sometimes I remain in the dark. My hue bulb ruleset acts similar: sometimes I just tap on selection and immediately the bulb scene is loaded and the lights power - and sometimes I tap on selection, OH enters the rule and leaves it without any comment. When I tap again and again on the same selection it’s eventually loaded. But that’s no intended behaviour for a ruleset, isn’t it?
So what should I do? Should I avoid using this case-switch
thing? Is it officially supported? If it is: what am I doing wrong? What could you suggest?
Thank you very much!
Marianne
- Platform information:
- Hardware: 4 core Atom, 2GB RAM
- OS: Debian 9
- Java Runtime Environment: zulu-8.28.0.1
- openHAB version: openhab2-2.2.0-1