Here is the events.log from last night when I turned everything off:
2015-09-16 21:51:25 - Light_Bedroom_Nightstand_DoubleClick state updated to OFF
2015-09-16 21:51:25 - Light_Bedroom_Nightstand state updated to OFF
2015-09-16 21:51:25 - Lights received command OFF
2015-09-16 21:51:25 - Light_Living_Shelf received command OFF
2015-09-16 21:51:25 - Light_Bedroom_Dresser received command OFF
2015-09-16 21:51:25 - Light_Bedroom_Nightstand received command OFF
2015-09-16 21:51:26 - Light_Living_Shelf_Level state updated to OFF
2015-09-16 21:51:26 - Light_Living_Shelf state updated to OFF
Now that I think about it though, I’m also explicitly setting everything off in my rules. If I have time tonight, I’ll disable the rule and test again.
Only the switches will update their state properly when faston and fastoff are clicked.
The dimmers do not handle it correctly (they don’t have a handler installed). Bug.
Fixing it.
I now get the following in the events log, which is just as I would expect:
6335 2015-10-02 12:11:28 - masterBedLightsFastOnOff state updated to ON
6336 2015-10-02 12:11:28 - masterBedLights state updated to ON
6337 2015-10-02 12:11:34 - masterBedLightsFastOnOff state updated to OFF
6338 2015-10-02 12:11:34 - masterBedLights state updated to OFF
My problem now is that I can’t seem to get the fastonoff feature to trigger any rules. I have the following rules for the above items. When I trigger the fast on or fast off, I never see any of the log statements in the rules and the loft light doesn’t change. Am I doing something wrong in these rules?
rule "Turn off loft light when master bedroom light double tapped"
when Item masterBedLightsFastOnOff received update OFF
then
logInfo("masterBedLights FastOnOff", "received update OFF")
sendCommand(loftLight, OFF)
end
rule "Turn off loft light when master bedroom light double tapped 2"
when Item masterBedLightsFastOnOff received update ON
then
logInfo("masterBedLights FastOnOff", "received update ON")
sendCommand(loftLight, ON)
end
rule "Turn off loft light when master bedroom light double tapped 3"
when Item masterBedLightsFastOnOff received command
then
logInfo("masterBedLights FastOnOff", "masterBedLightsFastOnOff Received command [{}], state=[{}]", receivedCommand.toString(), masterBedLightsFastOnOff.state.toString())
end
Xtend scripting sucks big time, every which way. What do you expect, error messages? That’s for whimps!!!
Real men debug by trial and error!
Here’s my advice:
Switch to python scripting. I just wasted a full day or more to debug some problems with that, fun, fun. But it’s worth it. You get error messages and a well documented language without some screwy syntax like “Item changed” etc. Look for “jsr223” keyword to get started.
If you want to bang your head against this, use the Designer, that at least tells you about the worst syntax errors etc. If (if!) you can even run the bloated thing on whatever hardware you have openhab running.
I do use the designer, which did not show any errors on the above rules. I definitely have not loved Xtend either, and trying to understand its relationship with Java and when certain classes and commands are allowed vs when they are not.
The jsr223 scripting has definitely been on my radar with an api that seems more complete. I would probably use javascript since I do a lot of that in my day job, but the advice is good either way. Thanks for the tip.