sbidy / wiz_light

A WiZ Light integration for Home Assistant
MIT License
341 stars 68 forks source link

Wiz_light reports timeout error, when the light is not connected to the network #24

Closed rosch100 closed 4 years ago

rosch100 commented 4 years ago

Currently, when a light is not connected to the WLAN and thus found, the following error is logged:

2020-05-09 09:58:13 ERROR (MainThread) [pywizlight.bulb] [wizlight 192.168.253.47, connid 3873f89daae3e2] Failed to do UDP call(s) to wiz light
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pywizlight/bulb.py", line 314, in sendUDPMessage
    await receive_task
  File "/usr/local/lib/python3.7/site-packages/pywizlight/bulb.py", line 290, in receiveUDPwithTimeout
    data, remote_addr = await asyncio.wait_for(stream.recv(), timeout)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 449, in wait_for
    raise futures.TimeoutError()
concurrent.futures._base.TimeoutError

I suggest to change that to a warning, since it is expected behaviour, when the light is not connected to the network.

sbidy commented 4 years ago

This should be fixed with the current version with the updated pywizlight . Please update and test again.

sbidy commented 4 years ago

See #15

rosch100 commented 4 years ago

Just updated to the current implementation. Now it handles the exception, but still reports an error: 2020-05-09 10:52:53 ERROR (MainThread) [pywizlight.bulb] [wizlight 192.168.253.47, connid 38740040b2caf0] Failed to do UDP call(s) to wiz light I still think it's better to only report a warning (however, I'm not sure about the suggested behaviour in the HA development guidelines).

sbidy commented 4 years ago

Jep, it should be improved and the state should also be reported as "unavailable" to the HA update pool. But for now it looks little bit better :)