sbidy / wiz_light

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

ConnectionRefusedError appears in log when there are tasks waiting on light state changes #152

Closed emichael closed 2 years ago

emichael commented 3 years ago

I'm getting the following error quite a bit in my logs whenever I have tasks that are trying to read the state of lights in RGB mode. The Dashboard UI also hangs for five or ten seconds, but eventually my automations complete successfully and do the right thing.

Logger: homeassistant
Source: /usr/src/homeassistant/homeassistant/runner.py:97
First occurred: 12:02:52 PM (3 occurrences)
Last logged: 12:03:38 PM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/asyncio_dgram/aio.py", line 132, in send
    await super().send(data)
  File "/usr/local/lib/python3.8/site-packages/asyncio_dgram/aio.py", line 94, in send
    _ = self.exception
  File "/usr/local/lib/python3.8/site-packages/asyncio_dgram/aio.py", line 52, in exception
    raise exc
  File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 1011, in _read_ready
    data, addr = self._sock.recvfrom(self.max_size)
ConnectionRefusedError: [Errno 111] Connection refused

Specifically, I have a bit of pyscript that does the following:

wait_kwargs = {}
wait_kwargs["state_check_now"] = True
wait_kwargs["state_trigger"] = f'{entity_id} == "on"'
wait_kwargs["timeout"] = on_timeout_secs
trig_info = task.wait_until(**wait_kwargs)

current_state = state.get(entity_id)
current_attrs = state.getattr(entity_id)

The lights only really seem to hang when they're in color mode. color_temp mode seems to operate much more smoothly. My lights are the GU10 Phillips Wiz RGB/Kelvin bulbs.

sbidy commented 3 years ago

I can't reproduce this issue in my test lap. Appears this error only on one bulb or on everyone in your setup? The exceptions shows a connection issue but if all other requests are working it seems to be an issue with the bulb itself. Do you try a cold reboot oft the bulb?

bdraco commented 2 years ago

This can be closed as its fixed in the core version