Closed UrsusS closed 1 year ago
The item value is None
if there has been no value received from the device (e.g. after a restart).
If you restart your openHAB instance at night your suggestion would return false even though the shutter would actually be closed.
I'd rather log an error than return a possibly wrong value.
You can initialize the state on the HABApp side with set_value()
or post an update to the openHAB item when the rule gets initialized.
e.g.
def __init__():
...
self.run.soon(self.initialize)
def initialize(self):
if self.ShutterItem.value is not None:
# Chose one, depending on what you want to initialize
self.ShutterItem.post_value(0)
self.ShutterItem.oh_post_value(0)
# from the next release on
self.ShutterItem.post_value_if(0, is_=None)
self.ShutterItem.oh_post_value_if(0, is_=None)
Thanks for the hints. I see I have to solve it on application level as on library level it is not clear what the right reaction would be.
HABApp 1.0.4 openHAB 3.4.0.M2
A None-value of a rollershutter item leads to a TypeError in is_down().
I would expect that the code handles None values. May be something like this (not tested, just typed):