Silvest89 / yeelight_v2

13 stars 1 forks source link

Works with 5-10 seconds delay #6

Open remcotim opened 3 years ago

remcotim commented 3 years ago

The custom interation works with 5-10 seconds delay. I have 3x 1S (color4) bulbs connected with firmware 2.0.6_0030, on china server. If I change color, brightness or on/of, it takes about 5-10 seconds for the bulb to respond to the command. But they stay available until now, that's a huge improvement

The log is flooding with errors:

Logger: custom_components.yeelight_v2.python_yeelight.yeelight.main
Source: custom_components/yeelight_v2/python_yeelight/yeelight/main.py:823
Integration: YeelightV2 (documentation)
First occurred: 23:40:21 (124 occurrences)
Last logged: 23:52:23

timed out
[Errno 9] Bad file descriptor
2021-01-28 23:45:11 ERROR (SyncWorker_8) [custom_components.yeelight_v2.python_yeelight.yeelight.main] timed out
2021-01-28 23:45:11 ERROR (SyncWorker_12) [custom_components.yeelight_v2.python_yeelight.yeelight.main] timed out
2021-01-28 23:45:11 ERROR (SyncWorker_20) [custom_components.yeelight_v2.python_yeelight.yeelight.main] timed out
2021-01-28 23:45:37 DEBUG (SyncWorker_12) [custom_components.yeelight_v2.python_yeelight.yeelight.main] Milo: False, SSDP: True
2021-01-28 23:45:37 DEBUG (SyncWorker_12) [custom_components.yeelight_v2.python_yeelight.yeelight.main] LAN Control: Bulb<192.168.2.92:55443, type=BulbType.Color> > {'id': 10, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']}
2021-01-28 23:45:37 DEBUG (SyncWorker_9) [custom_components.yeelight_v2.python_yeelight.yeelight.main] Milo: False, SSDP: True
2021-01-28 23:45:37 DEBUG (SyncWorker_9) [custom_components.yeelight_v2.python_yeelight.yeelight.main] LAN Control: Bulb<192.168.2.93:55443, type=BulbType.Color> > {'id': 13, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']}
2021-01-28 23:45:37 DEBUG (SyncWorker_1) [custom_components.yeelight_v2.python_yeelight.yeelight.main] Milo: False, SSDP: True
2021-01-28 23:45:37 DEBUG (SyncWorker_1) [custom_components.yeelight_v2.python_yeelight.yeelight.main] LAN Control: Bulb<192.168.2.94:55443, type=BulbType.Color> > {'id': 18, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']}
2021-01-28 23:45:41 ERROR (SyncWorker_12) [custom_components.yeelight_v2.python_yeelight.yeelight.main] timed out
2021-01-28 23:45:41 ERROR (SyncWorker_9) [custom_components.yeelight_v2.python_yeelight.yeelight.main] timed out
2021-01-28 23:45:41 ERROR (SyncWorker_1) [custom_components.yeelight_v2.python_yeelight.yeelight.main] timed out
2021-01-28 23:46:07 DEBUG (SyncWorker_1) [custom_components.yeelight_v2.python_yeelight.yeelight.main] Milo: False, SSDP: True
2021-01-28 23:46:07 DEBUG (SyncWorker_1) [custom_components.yeelight_v2.python_yeelight.yeelight.main] LAN Control: Bulb<192.168.2.92:55443, type=BulbType.Color> > {'id': 11, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']}
2021-01-28 23:46:07 DEBUG (SyncWorker_9) [custom_components.yeelight_v2.python_yeelight.yeelight.main] Milo: False, SSDP: True
2021-01-28 23:46:07 DEBUG (SyncWorker_9) [custom_components.yeelight_v2.python_yeelight.yeelight.main] LAN Control: Bulb<192.168.2.93:55443, type=BulbType.Color> > {'id': 14, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']}
2021-01-28 23:46:07 DEBUG (SyncWorker_15) [custom_components.yeelight_v2.python_yeelight.yeelight.main] Milo: False, SSDP: True
2021-01-28 23:46:07 DEBUG (SyncWorker_15) [custom_components.yeelight_v2.python_yeelight.yeelight.main] LAN Control: Bulb<192.168.2.94:55443, type=BulbType.Color> > {'id': 19, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']}
2021-01-28 23:46:08 DEBUG (SyncWorker_11) [custom_components.yeelight_v2.python_yeelight.yeelight.main] LAN Control: Bulb<192.168.2.92:55443, type=BulbType.Color> > {'id': 12, 'method': 'set_power', 'params': ['on', 'smooth', 350]}
2021-01-28 23:46:08 INFO (SyncWorker_4) [homeassistant.components.command_line.switch] Running state value command: curl -s "http://192.168.2.66:7999/1/detection/status"
2021-01-28 23:46:11 ERROR (SyncWorker_15) [custom_components.yeelight_v2.python_yeelight.yeelight.main] timed out
2021-01-28 23:46:11 ERROR (SyncWorker_9) [custom_components.yeelight_v2.python_yeelight.yeelight.main] timed out
2021-01-28 23:46:11 ERROR (SyncWorker_1) [custom_components.yeelight_v2.python_yeelight.yeelight.main] timed out
2021-01-28 23:46:11 ERROR (SyncWorker_11) [custom_components.yeelight_v2.python_yeelight.yeelight.main] [Errno 9] Bad file descriptor
2021-01-28 23:46:11 DEBUG (SyncWorker_11) [custom_components.yeelight_v2.light] Calling <function YeelightGenericLight.set_rgb at 0x7f9f52ea60> with ((255, 0, 0), 350) {}
2021-01-28 23:46:11 DEBUG (SyncWorker_11) [custom_components.yeelight_v2.light] Setting RGB: (255, 0, 0)
2021-01-28 23:46:11 DEBUG (SyncWorker_11) [custom_components.yeelight_v2.python_yeelight.yeelight.main] LAN Control: Bulb<192.168.2.92:55443, type=BulbType.Color> > {'id': 13, 'method': 'set_rgb', 'params': [16711680, 'smooth', 350]}
2021-01-28 23:46:12 DEBUG (SyncWorker_11) [custom_components.yeelight_v2.python_yeelight.yeelight.main] Response: Bulb<192.168.2.92:55443, type=BulbType.Color> < {'method': 'props', 'params': {'hue': 0, 'sat': 100, 'rgb': 16711680, 'color_mode': 1}}
2021-01-28 23:46:15 ERROR (SyncWorker_11) [custom_components.yeelight_v2.python_yeelight.yeelight.main] timed out

Did I do something wrong, or is there something wrong in the integration? On a sidenote: Could this also be the same problem with Hyperion. I'm not able to get them responding there too.

Thanks a lot, so far

remcotim commented 3 years ago

A few hours later:

Logger: custom_components.yeelight_v2.python_yeelight.yeelight.main
Source: custom_components/yeelight_v2/python_yeelight/yeelight/main.py:823
Integration: YeelightV2 (documentation)
First occurred: 0:08:00 (974 occurrences)
Last logged: 2:37:53

timed out
[Errno 9] Bad file descriptor
[Errno 113] Host is unreachable
[Errno 111] Connection refused

Just power cycled them by accident (unplugged from outlet), and the long delay in responding is solved. They change color almost immediate. I will update when this changes.

EDIT: They didn't lose connection anymore, but this Error keeps also keeps showing up in the log:

Logger: homeassistant
Source: custom_components/yeelight_v2/python_yeelight/yeelight/main.py:684
First occurred: 3:39:26 (1073 occurrences)
Last logged: 12:55:30

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/yeelight_v2/__init__.py", line 538, in _async_update
    await self._hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/yeelight_v2/__init__.py", line 532, in update
    self._update_properties()
  File "/config/custom_components/yeelight_v2/__init__.py", line 494, in _update_properties
    self.bulb.get_properties(UPDATE_REQUEST_PROPERTIES,
  File "/config/custom_components/yeelight_v2/python_yeelight/yeelight/main.py", line 682, in get_properties
    properties = {
  File "/config/custom_components/yeelight_v2/python_yeelight/yeelight/main.py", line 684, in <dictcomp>
    for k in requested_properties if k in capabilities
TypeError: argument of type 'NoneType' is not iterable

EDIT 2: 1 out of 3 bulbs can't change color via HA anymore and turning on/off is with a delay again.

Logger: homeassistant.core
Source: custom_components/yeelight_v2/python_yeelight/yeelight/main.py:1126
First occurred: 19:04:40 (18 occurrences)
Last logged: 19:10:21

Error executing service: <ServiceCall light.turn_on (c:ecd7dc7b7ba745db95b2d92e12574381): entity_id=['light.left_yee'], params=hs_color=(300.0, 100.0)>
Error executing service: <ServiceCall light.turn_on (c:100ae10db1b6e6f94847cab9bd31572c): entity_id=['light.gateway_light', 'light.theater', 'light.left_yee', 'light.right_yee', 'light.table_yee'], params=hs_color=(360.0, 100.0)>
Error executing service: <ServiceCall light.turn_on (c:1f81d01ca82e5a9a360e853b6c5c9cfe): entity_id=['light.gateway_light', 'light.theater', 'light.left_yee', 'light.right_yee', 'light.table_yee'], params=hs_color=(345.0, 100.0)>
Error executing service: <ServiceCall light.turn_on (c:6c70b0f8e6a07459386059b6049f876f): entity_id=['light.gateway_light', 'light.theater', 'light.left_yee', 'light.right_yee', 'light.table_yee'], params=hs_color=(360.0, 100.0)>
Error executing service: <ServiceCall light.turn_on (c:fa616874ec4468bc9aaebcd86452792f): entity_id=['light.gateway_light', 'light.theater', 'light.left_yee', 'light.right_yee', 'light.table_yee'], params=hs_color=(360.0, 100.0)>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/core.py", line 1459, in catch_exceptions
    await coro_or_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1478, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 595, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 664, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 632, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 233, in async_handle_light_on_service
    await light.async_turn_on(**params)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 690, in async_turn_on
    await self.hass.async_add_executor_job(ft.partial(self.turn_on, **kwargs))
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/yeelight_v2/light.py", line 736, in turn_on
    self.set_music_mode(self.config[CONF_MODE_MUSIC])
  File "/config/custom_components/yeelight_v2/light.py", line 612, in set_music_mode
    self._bulb.start_music()
  File "/config/custom_components/yeelight_v2/python_yeelight/yeelight/main.py", line 1126, in start_music
    conn, _ = s.accept()
  File "/usr/local/lib/python3.8/socket.py", line 292, in accept
    fd, addr = self._accept()
socket.timeout: timed out
zatarra77 commented 3 years ago

Same issue. My log:

2021-01-31 15:42:10 ERROR (SyncWorker_7) [custom_components.yeelight_v2.python_yeelight.yeelight.main] timed out 2021-01-31 15:42:10 DEBUG (SyncWorker_7) [custom_components.yeelight_v2.python_yeelight.yeelight.main] Milo: False, SSDP: True 2021-01-31 15:42:10 DEBUG (SyncWorker_7) [custom_components.yeelight_v2.python_yeelight.yeelight.main] LAN Control: Bulb<192.168.0.81:55443, type=BulbType.Color> > {'id': 72, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']} 2021-01-31 15:42:14 ERROR (SyncWorker_7) [custom_components.yeelight_v2.python_yeelight.yeelight.main] timed out 2021-01-31 15:42:19 DEBUG (SyncWorker_3) [custom_components.yeelight_v2.python_yeelight.yeelight.main] Milo: False, SSDP: True 2021-01-31 15:42:19 DEBUG (SyncWorker_3) [custom_components.yeelight_v2.python_yeelight.yeelight.main] LAN Control: Bulb<192.168.0.81:55443, type=BulbType.Color> > {'id': 73, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']} 2021-01-31 15:42:22 ERROR (SyncWorker_3) [custom_components.yeelight_v2.python_yeelight.yeelight.main] timed out 2021-01-31 15:42:49 DEBUG (SyncWorker_14) [custom_components.yeelight_v2.python_yeelight.yeelight.main] Milo: False, SSDP: True 2021-01-31 15:42:49 DEBUG (SyncWorker_14) [custom_components.yeelight_v2.python_yeelight.yeelight.main] LAN Control: Bulb<192.168.0.81:55443, type=BulbType.Color> > {'id': 74, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']} 2021-01-31 15:42:52 ERROR (SyncWorker_14) [custom_components.yeelight_v2.python_yeelight.yeelight.main] timed out 2021-01-31 15:43:19 DEBUG (SyncWorker_0) [custom_components.yeelight_v2.python_yeelight.yeelight.main] Milo: False, SSDP: True 2021-01-31 15:43:19 DEBUG (SyncWorker_0) [custom_components.yeelight_v2.python_yeelight.yeelight.main] LAN Control: Bulb<192.168.0.81:55443, type=BulbType.Color> > {'id': 75, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']} 2021-01-31 15:43:22 ERROR (SyncWorker_0) [custom_components.yeelight_v2.python_yeelight.yeelight.main] timed out 2021-01-31 15:43:49 DEBUG (SyncWorker_1) [custom_components.yeelight_v2.python_yeelight.yeelight.main] Milo: False, SSDP: True 2021-01-31 15:43:49 DEBUG (SyncWorker_1) [custom_components.yeelight_v2.python_yeelight.yeelight.main] LAN Control: Bulb<192.168.0.81:55443, type=BulbType.Color> > {'id': 76, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']} 2021-01-31 15:43:52 ERROR (SyncWorker_1) [custom_components.yeelight_v2.python_yeelight.yeelight.main] timed out 2021-01-31 15:44:19 DEBUG (SyncWorker_3) [custom_components.yeelight_v2.python_yeelight.yeelight.main] Milo: False, SSDP: True 2021-01-31 15:44:19 DEBUG (SyncWorker_3) [custom_components.yeelight_v2.python_yeelight.yeelight.main] LAN Control: Bulb<192.168.0.81:55443, type=BulbType.Color> > {'id': 77, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']} 2021-01-31 15:44:22 ERROR (SyncWorker_3) [custom_components.yeelight_v2.python_yeelight.yeelight.main] timed out 2021-01-31 15:44:49 DEBUG (SyncWorker_8) [custom_components.yeelight_v2.python_yeelight.yeelight.main] Milo: False, SSDP: True 2021-01-31 15:44:49 DEBUG (SyncWorker_8) [custom_components.yeelight_v2.python_yeelight.yeelight.main] LAN Control: Bulb<192.168.0.81:55443, type=BulbType.Color> > {'id': 78, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']} 2021-01-31 15:44:52 ERROR (SyncWorker_8) [custom_components.yeelight_v2.python_yeelight.yeelight.main] timed out 2021-01-31 15:45:19 DEBUG (SyncWorker_3) [custom_components.yeelight_v2.python_yeelight.yeelight.main] Milo: False, SSDP: True 2021-01-31 15:45:19 DEBUG (SyncWorker_3) [custom_components.yeelight_v2.python_yeelight.yeelight.main] LAN Control: Bulb<192.168.0.81:55443, type=BulbType.Color> > {'id': 79, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']} 2021-01-31 15:45:22 ERROR (SyncWorker_3) [custom_components.yeelight_v2.python_yeelight.yeelight.main] timed out