home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.53k stars 30.71k forks source link

Yeelight bulb changes color on changing brightness #38477

Closed agneevX closed 4 years ago

agneevX commented 4 years ago

The problem

  1. When I'm changing the brightness of the lamp via the frontend, the color of the lamp keeps defaulting to the color temperature that is set.

  2. When changing the color of the bulb, the change is not smooth but rather abrupt. E.g. when changing to red, it changes to a color near red, then changes to red.

Screen recording

https://www.dropbox.com/s/bav38hnsvfpylum/screen_recording.mp4?dl=0

Here, I change the color to pink and increase the brightness (note how the color also changes). Then I change the color temperature all the way to cold, set the color to light purple (note how the color shifts across) and finally change the brightness, when the color again changes to white.

Environment

Problem-relevant configuration.yaml

  10.0.0.41:
    name: TV Lamp
    transition: 500
    model: bslamp2
    nightlight_switch_type: light

Traceback/Error logs

2020-08-02 16:30:28 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=light, service=turn_on, service_data=entity_id=light.tv_lamp, hs_color=[300, 85.71428571428571]>
2020-08-02 16:30:28 DEBUG (SyncWorker_9) [yeelight.main] Bulb<10.0.0.41:55443, type=BulbType.Color> > {'id': 3, 'method': 'set_power', 'params': ['on', 'smooth', 500, 1]}
2020-08-02 16:30:28 DEBUG (SyncWorker_9) [yeelight.main] Bulb<10.0.0.41:55443, type=BulbType.Color> < {'id': 3, 'result': ['ok']}
2020-08-02 16:30:28 DEBUG (SyncWorker_9) [homeassistant.components.yeelight.light] Calling <function YeelightGenericLight.set_rgb at 0xa3bf0d20> with ((255, 36, 255), 500) {}
2020-08-02 16:30:28 DEBUG (SyncWorker_9) [homeassistant.components.yeelight.light] Setting RGB: (255, 36, 255)
2020-08-02 16:30:28 DEBUG (SyncWorker_9) [yeelight.main] Bulb<10.0.0.41:55443, type=BulbType.Color> > {'id': 4, 'method': 'set_rgb', 'params': [16721151, 'smooth', 500]}
2020-08-02 16:30:28 DEBUG (SyncWorker_9) [yeelight.main] Bulb<10.0.0.41:55443, type=BulbType.Color> < {'method': 'props', 'params': {'hue': 300, 'sat': 85, 'rgb': 16721151, 'color_mode': 1}}
2020-08-02 16:30:28 DEBUG (SyncWorker_9) [yeelight.main] Bulb<10.0.0.41:55443, type=BulbType.Color> < {'id': 4, 'result': ['ok']}
2020-08-02 16:30:28 DEBUG (SyncWorker_9) [homeassistant.components.yeelight.light] Calling <function YeelightGenericLight.set_colortemp at 0xa3bf0e40> with (None, 500) {}
2020-08-02 16:30:28 DEBUG (SyncWorker_9) [homeassistant.components.yeelight.light] Calling <function YeelightGenericLight.set_brightness at 0xa3bf0db0> with (None, 500) {}
2020-08-02 16:30:28 DEBUG (SyncWorker_9) [homeassistant.components.yeelight.light] Calling <function YeelightGenericLight.set_flash at 0xa3bf0ed0> with (None,) {}
2020-08-02 16:30:28 DEBUG (SyncWorker_9) [homeassistant.components.yeelight.light] Calling <function YeelightGenericLight.set_effect at 0xa3b21780> with (None,) {}
2020-08-02 16:30:28 DEBUG (SyncWorker_9) [yeelight.main] Bulb<10.0.0.41:55443, type=BulbType.Color> > {'id': 5, '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']}
2020-08-02 16:30:28 DEBUG (SyncWorker_9) [yeelight.main] Bulb<10.0.0.41:55443, type=BulbType.Color> < {'id': 5, 'result': ['on', '', '63', '2314', '16721151', '300', '85', '1', '0', '', '', '', '', '', '', '', '', '0', '']}
2020-08-02 16:30:28 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.2755924688] Sending {'id': 40, 'type': 'result', 'success': True, 'result': {'context': Context(user_id='da971c77d52b440ea450680fadc76c61', parent_id=None, id='ba3a78c3a9d046dfa7ac8dfb44e1ee9c')}}
2020-08-02 16:30:28 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=light.tv_lamp, old_state=<state light.tv_lamp=on; min_mireds=153, max_mireds=588, effect_list=['Strobe color', 'Police', 'Christmas', 'RGB', 'Random Loop', 'Fast Random Loop', 'LSD', 'Slowdown', 'Disco', 'Strobe epilepsy!', 'Alarm', 'Police2', 'WhatsApp', 'Facebook', 'Twitter', 'Slow Temp', 'Stop'], brightness=161, color_temp=432, hs_color=(29.412, 79.714), rgb_color=(255, 151, 51), xy_color=(0.567, 0.389), flowing=False, night_light=False, friendly_name=TV Lamp, supported_features=63, icon=mdi:alarm-light @ 2020-08-02T16:29:28.831817+05:30>, new_state=<state light.tv_lamp=on; min_mireds=153, max_mireds=588, effect_list=['Strobe color', 'Police', 'Christmas', 'RGB', 'Random Loop', 'Fast Random Loop', 'LSD', 'Slowdown', 'Disco', 'Strobe epilepsy!', 'Alarm', 'Police2', 'WhatsApp', 'Facebook', 'Twitter', 'Slow Temp', 'Stop'], brightness=161, color_temp=432, hs_color=(300.0, 85.882), rgb_color=(255, 36, 255), xy_color=(0.384, 0.159), flowing=False, night_light=False, friendly_name=TV Lamp, supported_features=63, icon=mdi:alarm-light @ 2020-08-02T16:29:28.831817+05:30>>
2020-08-02 16:30:28 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.2755924688] Sending {'id': 2, 'type': 'event', 'event': <Event state_changed[L]: entity_id=light.tv_lamp, old_state=<state light.tv_lamp=on; min_mireds=153, max_mireds=588, effect_list=['Strobe color', 'Police', 'Christmas', 'RGB', 'Random Loop', 'Fast Random Loop', 'LSD', 'Slowdown', 'Disco', 'Strobe epilepsy!', 'Alarm', 'Police2', 'WhatsApp', 'Facebook', 'Twitter', 'Slow Temp', 'Stop'], brightness=161, color_temp=432, hs_color=(29.412, 79.714), rgb_color=(255, 151, 51), xy_color=(0.567, 0.389), flowing=False, night_light=False, friendly_name=TV Lamp, supported_features=63, icon=mdi:alarm-light @ 2020-08-02T16:29:28.831817+05:30>, new_state=<state light.tv_lamp=on; min_mireds=153, max_mireds=588, effect_list=['Strobe color', 'Police', 'Christmas', 'RGB', 'Random Loop', 'Fast Random Loop', 'LSD', 'Slowdown', 'Disco', 'Strobe epilepsy!', 'Alarm', 'Police2', 'WhatsApp', 'Facebook', 'Twitter', 'Slow Temp', 'Stop'], brightness=161, color_temp=432, hs_color=(300.0, 85.882), rgb_color=(255, 36, 255), xy_color=(0.384, 0.159), flowing=False, night_light=False, friendly_name=TV Lamp, supported_features=63, icon=mdi:alarm-light @ 2020-08-02T16:29:28.831817+05:30>>}
2020-08-02 16:30:31 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.2755924688] Received {'type': 'call_service', 'domain': 'light', 'service': 'turn_on', 'service_data': {'entity_id': 'light.tv_lamp', 'brightness': 176}, 'id': 41}
2020-08-02 16:30:31 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=light, service=turn_on, service_data=entity_id=light.tv_lamp, brightness=176>
2020-08-02 16:30:31 DEBUG (SyncWorker_7) [yeelight.main] Bulb<10.0.0.41:55443, type=BulbType.Color> > {'id': 6, 'method': 'set_power', 'params': ['on', 'smooth', 500, 1]}
2020-08-02 16:30:31 DEBUG (SyncWorker_7) [yeelight.main] Bulb<10.0.0.41:55443, type=BulbType.Color> < {'method': 'props', 'params': {'color_mode': 2}}
2020-08-02 16:30:31 DEBUG (SyncWorker_7) [yeelight.main] Bulb<10.0.0.41:55443, type=BulbType.Color> < {'id': 6, 'result': ['ok']}
2020-08-02 16:30:31 DEBUG (SyncWorker_7) [homeassistant.components.yeelight.light] Calling <function YeelightGenericLight.set_rgb at 0xa3bf0d20> with (None, 500) {}
2020-08-02 16:30:31 DEBUG (SyncWorker_7) [homeassistant.components.yeelight.light] Calling <function YeelightGenericLight.set_colortemp at 0xa3bf0e40> with (None, 500) {}
2020-08-02 16:30:31 DEBUG (SyncWorker_7) [homeassistant.components.yeelight.light] Calling <function YeelightGenericLight.set_brightness at 0xa3bf0db0> with (176, 500) {}
2020-08-02 16:30:31 DEBUG (SyncWorker_7) [homeassistant.components.yeelight.light] Setting brightness: 176
2020-08-02 16:30:31 DEBUG (SyncWorker_7) [yeelight.main] Bulb<10.0.0.41:55443, type=BulbType.Color> > {'id': 7, 'method': 'set_bright', 'params': [69.01960784313725, 'smooth', 500]}
2020-08-02 16:30:31 DEBUG (SyncWorker_7) [yeelight.main] Bulb<10.0.0.41:55443, type=BulbType.Color> < {'method': 'props', 'params': {'bright': 69}}
2020-08-02 16:30:31 DEBUG (SyncWorker_7) [yeelight.main] Bulb<10.0.0.41:55443, type=BulbType.Color> < {'id': 7, 'result': ['ok']}
2020-08-02 16:30:31 DEBUG (SyncWorker_7) [homeassistant.components.yeelight.light] Calling <function YeelightGenericLight.set_flash at 0xa3bf0ed0> with (None,) {}
2020-08-02 16:30:31 DEBUG (SyncWorker_7) [homeassistant.components.yeelight.light] Calling <function YeelightGenericLight.set_effect at 0xa3b21780> with (None,) {}
2020-08-02 16:30:31 DEBUG (SyncWorker_7) [yeelight.main] Bulb<10.0.0.41:55443, type=BulbType.Color> > {'id': 8, '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']}
2020-08-02 16:30:31 DEBUG (SyncWorker_7) [yeelight.main] Bulb<10.0.0.41:55443, type=BulbType.Color> < {'id': 8, 'result': ['on', '', '69', '2314', '16721151', '300', '85', '2', '0', '', '', '', '', '', '', '', '', '0', '']}
2020-08-02 16:30:31 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.2755924688] Sending {'id': 41, 'type': 'result', 'success': True, 'result': {'context': Context(user_id='da971c77d52b440ea450680fadc76c61', parent_id=None, id='ed5c3260a9274d18b708332870043535')}}

Additional information

I removed the lamp and restarted HA and deleted the entities. Re-added the lamp back and the issue remains. Weirdly enough when I did this last night, the issue was resolved.

agneevX commented 4 years ago

This seems to be a form of regression from using the Night Light switch. Removing the offending line from the config fixes it. Closing for now.