… without the else part it works.
With the else part it briefly starts the blind and stops it. Why?
The timer is null, hence, the else part should not run!
I also noticed that I cannot check the status of a time in karaf:
openhab> smarthome:status NLO_Window_Timer
Error: Item 'NLO_Window_Timer' does not exist.
Well… OH seems to work just fine… it seems the blind motor needs to be controlled differently.
Here the events.log
--> without else
2021-08-11 18:42:44.621 [ome.event.ItemCommandEvent] - Item 'TX433_Blind_StdShade' received command ON
2021-08-11 18:42:44.627 [vent.ItemStateChangedEvent] - TX433_Blind_StdShade changed from OFF to ON
2021-08-11 18:42:52.643 [ome.event.ItemCommandEvent] - Item 'TX433_Blind_StdShade' received command OFF
2021-08-11 18:42:52.649 [vent.ItemStateChangedEvent] - TX433_Blind_StdShade changed from ON to OFF
--> with else
2021-08-11 18:43:47.725 [ome.event.ItemCommandEvent] - Item 'TX433_Blind_StdShade' received command ON
2021-08-11 18:43:47.732 [vent.ItemStateChangedEvent] - TX433_Blind_StdShade changed from OFF to ON
2021-08-11 18:43:55.781 [ome.event.ItemCommandEvent] - Item 'TX433_Blind_StdShade' received command OFF
2021-08-11 18:43:55.813 [vent.ItemStateChangedEvent] - TX433_Blind_StdShade changed from ON to OFF
Thanks for looking into this.
This motor an AM25 tube motor only needs three commands, up, down, stop.
I have to revisit why there is an after-down|-up command that doesn’t seem to be required. Maybe it is… I have to investigate.
For now this post is marked resolved, as it is not a rule issue. Thanks.
Well, no. Variables only exist inside the rules framework. If you want to know what it is, you must log it out in your rule. (Timer handle variables look like gobbledygook when you do that, that’s fine, you’re interested if null or not)
There’s no point putting timer cancel() at end of its own code block - it’s already done by then. Maybe you meant to set its own handle to null, that’s a common technique.