core: Yeelight bulb become unavailable in HA after an hour

The problem

I’ve got Yeelight smart bulb w1 added to HA via Yeelight integration. After power cycling control works fine, but in a hour bulb become unavailable for a while in HA, then available again and after this i can not control it (what’s interesting is that light.turn_on enable it, but many exceptions appearing in logs and disabling not work)

At the same time bulb controllable via Yeelight application with no problems.

What version of Home Assistant Core has the issue?

2022.6.7

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Yeelight

Link to integration documentation on our website

https://www.home-assistant.io/integrations/yeelight/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2022-06-29 01:15:29 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [2768288376] Error when calling async_set_default for bulb Yeelight Monob 0x1876e50a at 192.168.88.86: {'code': -5006, 'message': 'illegal request'}
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/yeelight/light.py", line 243, in _async_wrap
return await func(self, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/components/yeelight/light.py", line 707, in async_set_default
await self._bulb.async_set_default()
File "/usr/local/lib/python3.9/site-packages/yeelight/aio.py", line 38, in wrapper
cmd = await self.async_send_command(
File "/usr/local/lib/python3.9/site-packages/yeelight/aio.py", line 96, in async_send_command
raise BulbException(response["error"])
yeelight.main.BulbException: {'code': -5006, 'message': 'illegal request'}
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 193, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1704, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1741, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 680, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 964, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 717, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 553, in async_handle_light_on_service
await light.async_turn_on(**filter_turn_on_params(light, params))
File "/usr/src/homeassistant/homeassistant/components/yeelight/light.py", line 805, in async_turn_on
await self.async_set_default()
File "/usr/src/homeassistant/homeassistant/components/yeelight/light.py", line 263, in _async_wrap
raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Error when calling async_set_default for bulb Yeelight Monob 0x1876e50a at 192.168.88.86: {'code': -5006, 'message': 'illegal request'}
2022-06-29 02:08:34 ERROR (MainThread) [homeassistant.core] Error executing service: <ServiceCall light.turn_on (c:01G6P94SJRQN525DY4TTEN78V9): entity_id=['light.bathroom_light'], params=>
Traceback (most recent call last):
File "/usr/local/lib/python3.9/asyncio/tasks.py", line 490, in wait_for
return fut.result()
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/yeelight/light.py", line 243, in _async_wrap
return await func(self, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/components/yeelight/light.py", line 771, in _async_turn_on
await self._bulb.async_turn_on(
File "/usr/local/lib/python3.9/site-packages/yeelight/aio.py", line 38, in wrapper
cmd = await self.async_send_command(
File "/usr/local/lib/python3.9/site-packages/yeelight/aio.py", line 93, in async_send_command
response = await asyncio.wait_for(future, TIMEOUT)
File "/usr/local/lib/python3.9/asyncio/tasks.py", line 492, in wait_for
raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/core.py", line 1722, in catch_exceptions
await coro_or_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1741, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 680, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 964, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 717, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 553, in async_handle_light_on_service
await light.async_turn_on(**filter_turn_on_params(light, params))
File "/usr/src/homeassistant/homeassistant/components/yeelight/light.py", line 791, in async_turn_on
await self._async_turn_on(duration)
File "/usr/src/homeassistant/homeassistant/components/yeelight/light.py", line 249, in _async_wrap
raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Timed out when calling _async_turn_on for bulb Yeelight Monob 0x1876e50a at 192.168.88.86: <class 'asyncio.exceptions.TimeoutError'>

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 3
  • Comments: 25 (2 by maintainers)

Most upvoted comments

I can also confirm that this issue is occuring with my Yeelight ceiling lights. I have 4 units and most work at any time however sometimes they drop off from Home Assistant. There are no issues using the Yeelight app and wifi signal is excellent (the logs below are from a unit just above the wifi router).

  • This issue has only manifested for me from 2022.8.6
  • Restarting Home Assistant has not resolved the issue
  • I have had no issues with any of the Yeelights with HA in the last 3 years until today
  • No issues accessing/pinging the device from the HA instance
Source: components/yeelight/light.py:249
First occurred: 06:10:22 (15 occurrences)
Last logged: 14:58:01

Error executing service: <ServiceCall light.turn_on (c:01GB738PMRGZNB1FJ6XCVB3QM0): entity_id=['light.study_light'], params=>
Error executing service: <ServiceCall light.turn_on (c:01GB738RTC386FT4FQDVW2HBPE): entity_id=['light.study_light'], params=>
Error executing service: <ServiceCall light.turn_on (c:01GB739P19Z9GDYZNVTQC6V8YX): entity_id=['light.study_light'], params=>
Error executing service: <ServiceCall light.turn_on (c:01GB739S507YJP9S9E53T6EHR5): entity_id=['light.study_light'], params=>
Error executing service: <ServiceCall light.turn_on (c:01GB73ABFMB470DBV2C6X1SBVD): entity_id=['light.study_light'], params=>
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 456, in wait_for
    return fut.result()
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/yeelight/light.py", line 243, in _async_wrap
    return await func(self, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/components/yeelight/light.py", line 771, in _async_turn_on
    await self._bulb.async_turn_on(
  File "/usr/local/lib/python3.10/site-packages/yeelight/aio.py", line 38, in wrapper
    cmd = await self.async_send_command(
  File "/usr/local/lib/python3.10/site-packages/yeelight/aio.py", line 93, in async_send_command
    response = await asyncio.wait_for(future, TIMEOUT)
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 458, in wait_for
    raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/core.py", line 1731, in catch_exceptions
    await coro_or_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1750, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 676, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 930, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 713, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 553, in async_handle_light_on_service
    await light.async_turn_on(**filter_turn_on_params(light, params))
  File "/usr/src/homeassistant/homeassistant/components/yeelight/light.py", line 791, in async_turn_on
    await self._async_turn_on(duration)
  File "/usr/src/homeassistant/homeassistant/components/yeelight/light.py", line 249, in _async_wrap
    raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Timed out when calling _async_turn_on for bulb Study light at 10.0.1.16: <class 'asyncio.exceptions.TimeoutError'>

Logs after restarting HA: Config entry 'Study light' for yeelight integration not ready yet: Could not fetch initial state; try power cycling the device; Retrying in background