openhab / org.openhab.binding.zwave

openHAB binding for Z-Wave
Eclipse Public License 2.0
170 stars 202 forks source link

Polling (REFRESH command) over un-initialized thing #567

Open IOOOTARobby opened 7 years ago

IOOOTARobby commented 7 years ago

The problem arises when we start ESH while one of the devices (domitech LED light bulb) is not powered. ESH detects that device as "ONLINE", while it's not.

We periodically poll all the powered devices with a REFRESH command (once in a minute): it works perfectly even with the bulb if it is powered during ESH boot.

Otherwise, the REFRESH is regularly deferred because the device results to be not initialized. The check is performed at this line of the ZWaveThingHandler class.

The bulb seems to never complete its initialization, thus the polling is always deferred and ESH state results erroneously "ONLINE".

Switching the bulb ON and then OFF normalizes the situation: then the polling acts as expected (ONLINE and OFFLINE state are correctly detected).

I don't know if it should be possible to poll a device that is not completely initialized, I guess it would be not a proper action. It may have sense to put a DEVICE in INITIALIZING or UNITIALIZED state if the poll is deferred for that particular reason.

Here is the relevant part of the log, the full log is attached, together with the node's XML.

2017-05-12 16:34:19,759 | DEBUG | safeCall-7       | ZWaveThingHandler                | NODE 3: Command received zwave:device:zwavectrl:node3:switch_dimmer --> REFRESH
2017-05-12 16:34:19,795 | DEBUG | safeCall-7       | ZWaveThingHandler                | NODE 3: Polling intialised at 1800 seconds - start in 50 milliseconds.
2017-05-12 16:34:19,825 | DEBUG | H-thingHandler-1 | ZWaveThingHandler                | NODE 3: Polling...
2017-05-12 16:34:19,845 | DEBUG | H-thingHandler-1 | ZWaveThingHandler                | NODE 3: Polling deferred until initialisation complete

Node XML file attached Full log attached

cdjackson commented 7 years ago

Wouldn’t it be better to find out why the device isn’t initialising? If the device isn’t fully initialised, then it probably won’t work properly, so polling it is not the only problem.

IOOOTARobby commented 7 years ago

I try to be clearer. This is the flow:

I think the device cannot be initialized until I turn the power on again, but at the same time it should not result as ONLINE in ESH.

Maybe I don't have the full picture, I will be glad if you could explain it to me, thanks a lot.

IOOOTARobby commented 7 years ago

Bump... ☺️