I’m using a power value of a Zwave plug that perfectly works. however, if this item is unplugged and Openhab resets/initializes with “–” the rule of course does not work anymore…
if (HomeOffice_Power.state > 200) .....
Does a simple (HomeOffice_Power.state == NULL) work?..if an item has never received any value and in the UI i can see a “–”.
There are two null states that an Item can have as a state. I assume the Zwave binding is using them correctly in which case:
State
Meaning
NULL
The Item has never received a state since openHAB loaded the Item, uninitialized
UNDEF
The binding has no way to determine the state of the device, unknown
You can check for both of these states (and you should in almost every Rule)
if(HomeOffice_Power.state intanceof UnDefType)
In Python that would be
if isinstance(items["HomeOffice_Power"], UnDeftype:
The Sitemap will render NULL and UNDEF with -. Look at events.log, or query for the state of the Item using the Karaf console or the REST API to see exactly what the state is.