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
71.13k stars 29.81k forks source link

Deconz unable to change light color #52665

Closed alim4r closed 3 years ago

alim4r commented 3 years ago

The problem

The light color can no longer be changed with the color wheel. It's still possible to set the color temperature, brightness and the light state (on/off).

What is version of Home Assistant Core has the issue?

core-2021.7.0

What was the last working version of Home Assistant Core?

core-2021.6.6

What type of installation are you running?

Home Assistant Container

Integration causing the issue

deconz

Link to integration documentation on our website

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

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

deconz/phoscon version: 2.12.01 / 14.6.2021

It's possible to load the deconz integration from 2021.6.6 as a custom component in 2021.7.0 to restore the functionality.

probot-home-assistant[bot] commented 3 years ago

deconz documentation deconz source (message by IssueLinks)

probot-home-assistant[bot] commented 3 years ago

Hey there @kane610, mind taking a look at this issue as its been labeled with an integration (deconz) you are listed as a codeowner for? Thanks! (message by CodeOwnersMention)

alim4r commented 3 years ago

I restarted home assistant and deconz a few times before creating this issue.

I restarted it a last time to add the debug output to the logger and it now works on some of my lights. My Phillips Hue bulbs are now working. I could have sworn they weren't working before.

All of my Lidl Livarno Lux Lights are not changing rgb color and could be related to #48281. This issue was created for version core-2021.3.4. I am not sure since it still works for me on 2021.6.6 but not on 2021.7.0.

Sorry about the confusion.

Log output

Starting

'7': {'colorcapabilities': 0,
'ctmax': 65279,
'ctmin': 0,
'etag': '6b2f2b7b77b0fa626db8f80d3da741f4',
'hascolor': True,
'lastannounced': None,
'lastseen': '2021-07-07T22:51Z',
'manufacturername': 'Heiman',
'modelid': 'TS0505A',
'name': 'TV Licht 1',
'state': {'alert': 'none',
'bri': 133,
'colormode': 'xy',
'ct': 499,
'effect': 'none',
'hue': 0,
'on': True,
'reachable': True,
'sat': 254,
'xy': [0.701, 0.299]},
'swversion': None,
'type': 'Extended color light',
'uniqueid': '84:2e:14:ff:fe:01:d6:08-01'},

Changing to a different color

2021-07-08 01:14:48 DEBUG (MainThread) [pydeconz.gateway] Sending "put" "{'on': True, 'hue': 43690, 'sat': 255}" to "192.168.0.115 /lights/7/state"
2021-07-08 01:14:48 DEBUG (MainThread) [pydeconz.gateway] HTTP request response: [{'success': {'/lights/7/state/on': True}},
{'success': {'/lights/7/state/hue': 43690}},
{'success': {'/lights/7/state/sat': 254}}]
2021-07-08 01:14:48 DEBUG (MainThread) [pydeconz.websocket] {"e":"changed","id":"7","r":"lights","state":{"alert":null,"bri":64,"colormode":"hs","ct":499,"effect":"none","hue":43690,"on":true,"reachable":true,"sat":254,"xy":[0.701,0.299]},"t":"event","uniqueid":"84:2e:14:ff:fe:01:d6:08-01"}
2021-07-08 01:14:49 DEBUG (MainThread) [pydeconz.websocket] {"e":"changed","id":"7","r":"lights","state":{"alert":null,"bri":64,"colormode":"xy","ct":499,"effect":"none","hue":0,"on":true,"reachable":true,"sat":254,"xy":[0.701,0.299]},"t":"event","uniqueid":"84:2e:14:ff:fe:01:d6:08-01"}

The second "e":"changed" at 2021-07-08 01:14:49 probably happens when the color cannot be set and gets reverted to the initial color.

Kane610 commented 3 years ago

Thanks. I'll try to have a look tonight

alim4r commented 3 years ago

If I change the color of the same light in 2021.6.6 "colormode":"xy" is used, instead of "colormode":"hs".

2021-07-08 12:18:31 DEBUG (MainThread) [pydeconz.gateway] Sending "put" "{'on': True, 'xy': (0.136, 0.04)}" to "192.168.0.115 /lights/7/state"
2021-07-08 12:18:31 DEBUG (MainThread) [pydeconz.gateway] HTTP request response: [{'success': {'/lights/7/state/on': True}},
{'success': {'/lights/7/state/xy': [0.136, 0.04]}}]
2021-07-08 12:18:31 DEBUG (MainThread) [pydeconz.websocket] {"e":"changed","id":"7","r":"lights","state":{"alert":null,"bri":13,"colormode":"xy","ct":419,"effect":"none","hue":0,"on":true,"reachable":true,"sat":254,"xy":[0.136,0.04]},"t":"event","uniqueid":"84:2e:14:ff:fe:01:d6:08-01"}
alim4r commented 3 years ago

Color can also be changed for my Lirvano bulbs in 2021.7.0 if xy_color is used.

Service call with xy_color works in 2021.7.0 Service call with hs_color does not work in 2021.7.0

Service call of the color wheel:

{
    "event_type": "call_service",
    "data": {
        "domain": "light",
        "service": "turn_on",
        "service_data": {
            "entity_id": "light.tv_licht_1",
            "hs_color": [
                240,
                100
            ]
        }
    },
    ...
}

I think in 2021.6.6 async def async_turn_on(self, **kwargs) checks the color mode of the device (if self._device.xy is not None) and converts hs to xy. light.py L173

In 2021.7.0 async def async_turn_on(self, **kwargs) only checks what attributes are given in the service call? (ATTR_HS_COLOR or ATTR_XY_COLOR) light.py L191 light.py L195

I'm not sure if I interpreted this correctly.

Kane610 commented 3 years ago

So if it works with xy but not hs I think the device shouldnt report hue and sat at all. If that is the case its an issue in deconz. I'll ask the deconz devs

Marlor commented 3 years ago

This may be connected, if not i open a new issue:

The deconz Light groups in core-2021.7.0 are stuck on Red even if this Group does not support color. In core-2021.6.6 there was no color wheel

List Group

min_mireds: 153
max_mireds: 500
effect_list:
  - colorloop
supported_color_modes:
  - color_temp
  - hs
  - xy
color_mode: hs
brightness: 254
hs_color:
  - 0
  - 49.804
rgb_color:
  - 255
  - 128
  - 128
xy_color:
  - 0.524
  - 0.313
is_deconz_group: true
all_on: true
friendly_name: Flur
supported_features: 44
icon: mdi:spotlight-beam
emontnemery commented 3 years ago

@ alim4r

In 2021.7.0 async def async_turn_on(self, **kwargs) only checks what attributes are given in the service call? (ATTR_HS_COLOR or ATTR_XY_COLOR)

This looks correct, the light service schema only allows a single color type in the service call, there's no need to check that again in the integration. Also, the color passed to the service call will be converted if the target light entity doesn't support it, for example a hs color will be converted to xy if the light supports xy but not hs.

Is the problem that the light claims to support hue+sat, but in real it only supports xy?

alim4r commented 3 years ago

@emontnemery

Is the problem that the light claims to support hue+sat, but in real it only supports xy?

These are the attributes of the Lirvano light (light.tv_licht_1):

min_mireds: 140
max_mireds: 650
effect_list:
  - colorloop
supported_color_modes:
  - color_temp
  - hs
  - xy
color_mode: xy
brightness: 196
hs_color:
  - 51.765
  - 100
rgb_color:
  - 255
  - 220
  - 0
xy_color:
  - 0.488
  - 0.48
is_deconz_group: false
friendly_name: TV Licht 1
icon: mdi:numeric-1-circle
supported_features: 44

It does say hs and xy for supported_color_modes.

Kane610 commented 3 years ago

Comment from @ebauuw: If memory serves, the regular LIDL Livarno Lux lights don't support Hue, Saturation, Color Loop, nor Color Capabilities. So they are whitelisted to remove / not to expose the corresponding attributes. However, the light in the mentioned issue shows manufacturer as "Heiman" and therefore isn't matched by the whitelist. I think that manufacturer used to be defaulted (before the Basic cluster was read) based on the Manufacturer Code, but that code has been commented out. My best guess is that the light was paired under an older version that didn't yet include the whitelist. Try and read the Manufacturer Name and Model Identifier attributes from the Basic cluster, and check if manufacturer is now set to "LIDL Livarno Lux". Then, after restarting deCONZ, the light should no longer have the attributes. If not, probably need to delete and re-pair the light.

Kane610 commented 3 years ago

@alim4r can you try out ebauuws suggestions?

alim4r commented 3 years ago

Thank you! Yes, I am reading into how to read from the basic cluster right now. If that does not work, I am going to re-pair the bulb and report back to you.

alim4r commented 3 years ago

Thanks for the help! @Kane610, @emontnemery, @ebauuw Even though the issue wasn't connected to the deconz integration after all and only happend to break with this version! :)

'7': {'ctmax': 65279,
'ctmin': 0,
'etag': '26ae1cb50172c12db60f73db35ab999e',
'hascolor': True,
'lastannounced': None,
'lastseen': '2021-07-09T09:53Z',
'manufacturername': 'LIDL Livarno Lux',
'modelid': 'HG06106B',
'name': 'TV Licht 1',
'state': {'alert': 'none',
'bri': 13,
'colormode': 'ct',
'ct': 419,
'on': True,
'reachable': True,
'xy': [0.701, 0.299]},
'swversion': None,
'type': 'Extended color light',
'uniqueid': '84:2e:14:ff:fe:01:d6:08-01'},
alim4r commented 3 years ago

The only problem I have now is that I can't change the color with the deconz light group. Since this is also an issue with the reported supported_color_modes from deconz itself and not the Home Assistant deconz integration, I assume this issue can be closed.

2021-07-09 12:07:53 DEBUG (MainThread) [pydeconz.gateway] Sending "put" "{'on': True, 'hue': 35498, 'sat': 255}" to "192.168.0.115 /groups/3/action"
2021-07-09 12:07:53 DEBUG (MainThread) [pydeconz.gateway] HTTP request response: [{'success': {'/groups/3/action/on': True}},
{'success': {'/groups/3/action/hue': 35498}},
{'success': {'/groups/3/action/sat': 255}}]
2021-07-09 12:07:53 DEBUG (MainThread) [pydeconz.websocket] {"e":"changed","id":"7","r":"lights","state":{"alert":null,"bri":254,"colormode":"hs","ct":269,"on":true,"reachable":true,"xy":[0.157,0.05]},"t":"event","uniqueid":"84:2e:14:ff:fe:01:d6:08-01"}
2021-07-09 12:07:53 DEBUG (MainThread) [pydeconz.websocket] {"e":"changed","id":"9","r":"lights","state":{"alert":null,"bri":168,"colormode":"hs","ct":419,"on":true,"reachable":true,"xy":[0.701,0.299]},"t":"event","uniqueid":"58:8e:81:ff:fe:f1:9b:70-01"}
2021-07-09 12:07:53 DEBUG (MainThread) [pydeconz.websocket] {"e":"changed","id":"11","r":"lights","state":{"alert":null,"bri":168,"colormode":"hs","ct":419,"on":true,"reachable":true,"xy":[0.701,0.299]},"t":"event","uniqueid":"58:8e:81:ff:fe:de:64:5c-01"}
2021-07-09 12:07:53 DEBUG (MainThread) [pydeconz.websocket] {"e":"changed","id":"8","r":"lights","state":{"alert":null,"bri":168,"colormode":"hs","ct":419,"on":true,"reachable":true,"xy":[0.148,0.165]},"t":"event","uniqueid":"58:8e:81:ff:fe:d5:be:60-01"}
2021-07-09 12:07:53 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/pydeconz/gateway.py", line 128, in session_handler
self.event_handler(self.websocket.data) # type: ignore
File "/usr/local/lib/python3.9/site-packages/pydeconz/gateway.py", line 169, in event_handler
device_class.process_raw({device_id: event})
File "/usr/local/lib/python3.9/site-packages/pydeconz/api.py", line 40, in process_raw
obj.update(raw_item)
File "/usr/local/lib/python3.9/site-packages/pydeconz/api.py", line 126, in update
async_signal_update()
File "/usr/src/homeassistant/homeassistant/components/deconz/deconz_device.py", line 92, in async_update_callback
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 419, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 455, in _async_write_ha_state
attr.update(self.state_attributes or {})
File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 861, in state_attributes
data.update(self._light_internal_convert_color(color_mode))
File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 795, in _light_internal_convert_color
if color_mode == COLOR_MODE_HS and self.hs_color:
File "/usr/src/homeassistant/homeassistant/components/deconz/light.py", line 169, in hs_color
return (self._device.hue / 65535 * 360, self._device.sat / 255 * 100)
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'

The Traceback error is repeated 6 times total, since 6 bulbs are in this group.

Group config

min_mireds: 153
max_mireds: 500
effect_list:
  - colorloop
supported_color_modes:
  - color_temp
  - hs
  - xy
color_mode: xy
brightness: 168
hs_color:
  - 0
  - 100
rgb_color:
  - 255
  - 0
  - 0
xy_color:
  - 0.701
  - 0.299
is_deconz_group: true
all_on: true
friendly_name: TV Licht
icon: mdi:floor-lamp
supported_features: 44
'3': {'action': {'alert': 'none',
'bri': 71,
'colormode': 'hs',
'ct': 0,
'effect': 'none',
'hue': 49117,
'on': True,
'sat': 169,
'scene': None,
'xy': [0, 0]},
'devicemembership': [],
'etag': 'f02c0b3e266aba2f3d8507fab8683434',
'id': '3',
'lights': ['7', '9', '11', '8', '6', '10'],
'name': 'TV Licht',
'scenes': [],
'state': {'all_on': False, 'any_on': True},
'type': 'LightGroup'},
sabbatho commented 3 years ago

I have the same issue, and for me it is only Ikea. i have Hue lights that still changes color correctly. I tried changing color on the Ikea lights through the color wheel, automation, and service call and nothing works. on and off works on the lights. Brightness works aswell. color_temp also works for me. It's only color_name, rgbw_color and rgb_color that i have tried that won't work for me.

I can see the automations trying to change in lovelace, but bulbs do nothing.

Got this as soon as i installed 2021.7.0 and have it still with 2021.7.1

if there is anything else i can test to help finding the problem, give a shout :) thanks in advance

Kane610 commented 3 years ago

@sabbatho please share logs similar to what has been shared above

Marlor commented 3 years ago

@Kane610 Had a look at light groups? Or do you want another issue fot this?

Kane610 commented 3 years ago

@Kane610 Had a look at light groups? Or do you want another issue fot this?

Light groups? I don't follow

Marlor commented 3 years ago

The Deconz light groups are stuck on color, even if they dont support it: https://github.com/home-assistant/core/issues/52665#issuecomment-876505527

The Group in core-2021.6.6:

effect_list:
  - colorloop
supported_color_modes:
  - brightness
color_mode: brightness
brightness: 254
is_deconz_group: true
all_on: true
friendly_name: Flur
supported_features: 45
icon: mdi:spotlight-beam

The Group in 2021.7.0:

min_mireds: 153
max_mireds: 500
effect_list:
  - colorloop
supported_color_modes:
  - color_temp
  - hs
  - xy
color_mode: hs
brightness: 254
hs_color:
  - 0
  - 49.804
rgb_color:
  - 255
  - 128
  - 128
xy_color:
  - 0.524
  - 0.313
is_deconz_group: true
all_on: true
friendly_name: Flur
supported_features: 44
icon: mdi:spotlight-beam
Kane610 commented 3 years ago

@Marlor https://github.com/home-assistant/core/issues/52661 should be that issue right?

Marlor commented 3 years ago

Yes i did not see #52661 sorry.

sabbatho commented 3 years ago

Sorry, not too sure about the logs. but i added the debug info to config and restarted. hope this helps? i let the automation trigger info be there aswell.

2021-07-10 14:57:26 INFO (MainThread) [homeassistant.components.automation.office_pc_on_motion] office_pc_on_motion: Running automation actions
2021-07-10 14:57:26 INFO (MainThread) [homeassistant.components.automation.office_pc_on_motion] office_pc_on_motion: Executing step call service
2021-07-10 14:57:26 INFO (MainThread) [homeassistant.components.automation.office_pc_on_motion] office_pc_on_motion: Executing step call service
2021-07-10 14:57:26 INFO (MainThread) [homeassistant.components.automation.office_pc_on_motion] office_pc_on_motion: Executing step call service
2021-07-10 14:57:26 DEBUG (MainThread) [pydeconz.gateway] Sending "put" "{'on': True, 'bri': 254, 'hue': 5996, 'sat': 255, 'transitiontime': 0}" to "core-deconz /lights/10/state"
2021-07-10 14:57:26 DEBUG (MainThread) [pydeconz.gateway] HTTP request response: [{'success': {'/lights/10/state/on': True}},
 {'success': {'/lights/10/state/bri': 254}},
 {'success': {'/lights/10/state/hue': 5996}},
 {'success': {'/lights/10/state/sat': 254}}]
2021-07-10 14:57:26 DEBUG (MainThread) [pydeconz.websocket] {"e":"changed","id":"10","r":"lights","state":{"alert":null,"bri":254,"colormode":"hs","effect":"colorloop","hue":5996,"on":true,"reachable":true,"sat":254,"xy":[0.597,0.387]},"t":"event","uniqueid":"bc:33:ac:ff:fe:21:82:83-01"}
2021-07-10 14:57:26 INFO (MainThread) [homeassistant.components.automation.office_pc_on_motion] office_pc_on_motion: Executing step call service
2021-07-10 14:57:26 DEBUG (MainThread) [pydeconz.gateway] Sending "put" "{'on': True, 'bri': 254, 'hue': 21845, 'sat': 255, 'transitiontime': 0}" to "core-deconz /lights/34/state"
2021-07-10 14:57:26 DEBUG (MainThread) [pydeconz.gateway] HTTP request response: [{'success': {'/lights/34/state/on': True}},
 {'success': {'/lights/34/state/bri': 254}},
 {'success': {'/lights/34/state/hue': 21845}},
 {'success': {'/lights/34/state/sat': 254}}]
2021-07-10 14:57:26 DEBUG (MainThread) [pydeconz.websocket] {"e":"changed","id":"34","r":"lights","state":{"alert":null,"bri":254,"colormode":"hs","effect":"none","hue":21845,"on":true,"reachable":true,"sat":254,"xy":[0.172,0.747]},"t":"event","uniqueid":"cc:cc:cc:ff:fe:40:a0:a1-01"}
2021-07-10 14:57:26 INFO (MainThread) [homeassistant.components.automation.office_pc_on_motion] office_pc_on_motion: Executing step call service
2021-07-10 14:57:26 DEBUG (MainThread) [pydeconz.gateway] Sending "put" "{'on': True, 'bri': 254, 'hue': 5996, 'sat': 255, 'transitiontime': 0}" to "core-deconz /lights/35/state"
2021-07-10 14:57:26 DEBUG (MainThread) [pydeconz.gateway] HTTP request response: [{'success': {'/lights/35/state/on': True}},
 {'success': {'/lights/35/state/bri': 254}},
 {'success': {'/lights/35/state/hue': 5996}},
 {'success': {'/lights/35/state/sat': 254}}]
2021-07-10 15:02:07 INFO (MainThread) [homeassistant.components.automation.office_pc_on_motion] office_pc_on_motion: Executing step call service
2021-07-10 15:02:07 DEBUG (MainThread) [pydeconz.gateway] Sending "put" "{'on': True, 'bri': 254, 'hue': 5996, 'sat': 255, 'transitiontime': 0}" to "core-deconz /lights/11/state"
2021-07-10 15:02:07 DEBUG (MainThread) [pydeconz.websocket] {"e":"changed","id":"35","r":"lights","state":{"alert":null,"bri":254,"colormode":"hs","effect":"none","hue":5996,"on":true,"reachable":true,"sat":254,"xy":[0.458,0.41]},"t":"event","uniqueid":"cc:cc:cc:ff:fe:a9:22:c5-01"}
2021-07-10 15:02:07 DEBUG (MainThread) [pydeconz.gateway] HTTP request response: [{'success': {'/lights/11/state/on': True}},
 {'success': {'/lights/11/state/bri': 254}},
 {'success': {'/lights/11/state/hue': 5996}},
 {'success': {'/lights/11/state/sat': 254}}]
2021-07-10 15:02:07 DEBUG (MainThread) [pydeconz.websocket] {"e":"changed","id":"11","r":"lights","state":{"alert":null,"bri":254,"colormode":"hs","effect":"none","hue":5996,"on":true,"reachable":true,"sat":254,"xy":[0.458,0.41]},"t":"event","uniqueid":"84:2e:14:ff:fe:7a:98:c1-01"}
2021-07-10 15:02:08 DEBUG (MainThread) [pydeconz.websocket] {"attr":{"colorcapabilities":8,"id":"35","lastannounced":"2021-07-09T20:38:59Z","lastseen":"2021-07-10T13:02Z","manufacturername":"IKEA of Sweden","modelid":"TRADFRI bulb E14 CWS opal 600lm","name":"Kontor color 2","swversion":"1.3.002","type":"Color light","uniqueid":"cc:cc:cc:ff:fe:a9:22:c5-01"},"e":"changed","id":"35","r":"lights","t":"event","uniqueid":"cc:cc:cc:ff:fe:a9:22:c5-01"}
2021-07-10 15:02:08 DEBUG (MainThread) [pydeconz.websocket] {"e":"changed","id":"35","r":"lights","state":{"alert":null,"bri":254,"colormode":"xy","effect":"none","hue":5996,"on":true,"reachable":true,"sat":254,"xy":[0.458,0.41]},"t":"event","uniqueid":"cc:cc:cc:ff:fe:a9:22:c5-01"}
Kane610 commented 3 years ago

You need to look at the logs from startup. It needs to be the whole device description else I can't do anything.

sabbatho commented 3 years ago

This is one of the bulbs:

            '11': {'colorcapabilities': 8,
                   'etag': 'a38e27e349339623dc42c56ef585c720',
                   'hascolor': True,
                   'lastannounced': '2021-07-09T17:57:26Z',
                   'lastseen': '2021-07-10T14:58Z',
                   'manufacturername': 'IKEA of Sweden',
                   'modelid': 'TRADFRI bulb E27 CWS opal 600lm',
                   'name': 'Kontor color 3',
                   'state': {'alert': 'none',
                             'bri': 254,
                             'colormode': 'xy',
                             'effect': 'none',
                             'hue': 5996,
                             'on': True,
                             'reachable': True,
                             'sat': 254,
                             'xy': [0.458, 0.41]},
                   'swversion': '1.3.002',
                   'type': 'Color light',
                   'uniqueid': '84:2e:14:ff:fe:7a:98:c1-01'},

heres another bulb that won't change color:

            '34': {'colorcapabilities': 8,
                   'etag': '7fe5435c6991f94f66ff82b715d57a89',
                   'hascolor': True,
                   'lastannounced': '2021-07-06T07:11:03Z',
                   'lastseen': '2021-07-10T14:59Z',
                   'manufacturername': 'IKEA of Sweden',
                   'modelid': 'TRADFRI bulb E14 CWS opal 600lm',
                   'name': 'Kontor color 1',
                   'state': {'alert': 'none',
                             'bri': 254,
                             'colormode': 'xy',
                             'effect': 'none',
                             'hue': 21845,
                             'on': True,
                             'reachable': True,
                             'sat': 254,
                             'xy': [0.172, 0.747]},
                   'swversion': '1.3.002',
                   'type': 'Color light',
                   'uniqueid': 'cc:cc:cc:ff:fe:40:a0:a1-01'},

Do you need something from this part also?

2021-07-10 16:59:42 DEBUG (MainThread) [pydeconz.gateway] HTTP request response: {'config': {'UTC': '2021-07-10T14:59:42',

Kane610 commented 3 years ago

Thanks. That looks like what I'll need. I will look at it tomorrow

mvoort1337 commented 3 years ago

Hi,

I'm seeing similar issues with my lights after upgrading to 2021.7.1 (I skipped 2021.7.0).

The symptoms:

Philips Hue lights use a different color than the color in the command issued. Ikea Trader lights don't switch color at all (using color wheel) Adaptive Lighting custom integration stopped working (https://github.com/basnijholt/adaptive-lighting/)

Edit: the Adaptive lighting integration doesn't throw any error messages in the logs, technically it still works but the Philips Hue and Tradfri lights stopped responding to commands issued by the integration.

What is version of Home Assistant Core has the issue?

core-2021.7.1

What was the last working version of Home Assistant Core?

core-2021.6.6

What type of installation are you running?

Home Assistant Operating System running in a VM

Integration causing the issue

deconz, although this might be an issue in core. It seems as if light color/temperature values aren't translated correctly.

Deconz Integration for Home Assistant 6.9.0 (deCONZ 2.11.5)

Example YAML snippet

Command issued (these are Philips Hue lights, except light.livingfloor which is an WLED):

`alias: lightslivingbedtime sequence:

Results in the light going to RGB 255,66,0.

The difference in hue is noticeable. It should be more red, but it looks more orange.

min_mireds: 153 max_mireds: 500 effect_list: colorloop supported_color_modes: color_temp, hs, xy color_mode: hs brightness: 50 hs_color: 15.469, 99.608 rgb_color: 255, 66, 0 xy_color: 0.675, 0.321 is_deconz_group: false friendly_name: Kitchenlamp supported_features: 44

I've used this script to set the color of the lights to this red color for 18 months or so, only after upgrading to 2021.7.x is the color of the Philips Hue lamp noticeably different.

As a comparison, the WLED that I have in living room still changes color correctly and it unaffected:

supported_color_modes: rgb color_mode: rgb brightness: 40 hs_color: 16.471, 100 rgb_color: 255, 70, 0 xy_color: 0.672, 0.324 effect: Solid intensity: 128 palette: Default playlist: null reverse: false speed: 128 friendly_name: Livingfloor icon: mdi:led-strip-variant supported_features: 36

Anything in the logs that might be useful for us?

Nothing yet, please point me to where I could look and I will gladly help.

Additional information

I'm not entirely sure, but it seems to be an issue with translating the light value from what is set by home assistent and what get's send to the actual light. With the Philips Hue it works, but the color is (slightly) different from what it should be. With the Tradfri it doesn't change as all

Kane610 commented 3 years ago

@mvoort1337 can you enable debugging and share what is sent to Deconz?

Kane610 commented 3 years ago

@sabbatho what it looks like in your events you get success per attribute meaning deconz has set color values. But you're saying that is not the case here even though it says success?

sabbatho commented 3 years ago

@Kane610 yes that is correct. how ever i try changing the color it won't change. I have changed nothing but installing version 2021.7.0 and .1

sabbatho commented 3 years ago

Addition that i just now tested: logged in to phoscon where i add lights and stuff, changing color in that gui works. It's just in Home Assistant it won't work, ie. all automations and the internal public gui :)

hope that helps?

Kane610 commented 3 years ago

@Kane610 yes that is correct. how ever i try changing the color it won't change. I have changed nothing but installing version 2021.7.0 and .1

Could you try going back to 2021.6 and collect the same logs?

Oekn5w commented 3 years ago

I also have the issue of not changing colors in 2021.7.x with the Tradfri E27 (TRADFRI bulb E27 CWS opal 600lm). However, I think every related debug output has already been written here.

I've digged through the history of the deconz/lights.py file and #51656 is the first time in the last 3 years at least, that the ATTR_HS_COLOR (HS was defined as the main color interface in #11288) unconditionally produces the "hs" data entry. Until 7 months ago, this attribute only produced "xy" data (converted from hs, #44059).

From what I see, the Tradfri bulb indeed lists hs as supported color mode, which we now see is not the case. Maybe hue and sat of the device are read-only for these?

Seeing as there was some talk about whitelists in the deconz software, is this something that should also be included in there? I didn't find this whitelisting in dresden-electronic's public repos.

@Kane610 Should we reintroduce the if self._device.xy is not None: stuff until this is further looked into? For me this is currently a blocker for the 2021.7 update.

Kane610 commented 3 years ago

I also have the issue of not changing colors in 2021.7.x with the Tradfri E27 (TRADFRI bulb E27 CWS opal 600lm). However, I think every related debug output has already been written here.

I've digged through the history of the deconz/lights.py file and #51656 is the first time in the last 3 years at least, that the ATTR_HS_COLOR (HS was defined as the main color interface in #11288) unconditionally produces the "hs" data entry. Until 7 months ago, this attribute only produced "xy" data (converted from hs, #44059).

From what I see, the Tradfri bulb indeed lists hs as supported color mode, which we now see is not the case. Maybe hue and sat of the device are read-only for these?

Seeing as there was some talk about whitelists in the deconz software, is this something that should also be included in there? I didn't find this whitelisting in dresden-electronic's public repos.

@Kane610 Should we reintroduce the if self._device.xy is not None: stuff until this is further looked into? For me this is currently a blocker for the 2021.7 update.

Im talking with devs on what the situation is. Something needs to be done of course.

A part of ebauuws response: "With colorcapabilities 8, the light wouldn’t support hue/sat. The API shouldn't have exposed hue, sat, not effect. Of course, an API client should use xy to set colour, except in the rare case where a light doesn't support xy, but does support hue/sat. I think I've only seen this for the pre-Hue Philips Living Color lights."

I've also inquired how to translate colorcapabilities to something better to hopefully do a simple solution to this.

Kane610 commented 3 years ago

Apparently device like Tuya as an example does not report color capabilities...

sabbatho commented 3 years ago

@Kane610 sorry for the late answer :( Looks i'm a little late with my answer and you have found a solution. But as requested here are some logs from 2021.6.6 incase you have use for it still :)

            '11': {'colorcapabilities': 8,
                   'etag': 'eeabe3e3ad99d21bf24bd2e4151d1d36',
                   'hascolor': True,
                   'lastannounced': '2021-07-05T15:04:25Z',
                   'lastseen': '2021-07-11T17:44Z',
                   'manufacturername': 'IKEA of Sweden',
                   'modelid': 'TRADFRI bulb E27 CWS opal 600lm',
                   'name': 'Kontor color 3',
                   'state': {'alert': 'none',
                             'bri': 254,
                             'colormode': 'xy',
                             'effect': 'none',
                             'hue': 0,
                             'on': True,
                             'reachable': True,
                             'sat': 0,
                             'xy': [0.597, 0.387]},
                   'swversion': '1.3.002',
                   'type': 'Color light',
                   'uniqueid': '84:2e:14:ff:fe:7a:98:c1-01'},

second example.

            '34': {'colorcapabilities': 8,
                   'etag': '5359960507449ea2cf151f527d6da6b3',
                   'hascolor': True,
                   'lastannounced': '2021-07-06T07:11:03Z',
                   'lastseen': '2021-07-11T17:44Z',
                   'manufacturername': 'IKEA of Sweden',
                   'modelid': 'TRADFRI bulb E14 CWS opal 600lm',
                   'name': 'Kontor color 1',
                   'state': {'alert': 'none',
                             'bri': 254,
                             'colormode': 'xy',
                             'effect': 'none',
                             'hue': 0,
                             'on': True,
                             'reachable': True,
                             'sat': 0,
                             'xy': [0.172, 0.747]},
                   'swversion': '1.3.002',
                   'type': 'Color light',
                   'uniqueid': 'cc:cc:cc:ff:fe:40:a0:a1-01'},

and last logs when automation is active

2021-07-11 19:50:41 INFO (MainThread) [homeassistant.components.automation.office_pc_on_motion] office_pc_on_motion: Running automation actions
2021-07-11 19:50:41 INFO (MainThread) [homeassistant.components.automation.office_pc_on_motion] office_pc_on_motion: Executing step call service
2021-07-11 19:50:41 INFO (MainThread) [homeassistant.components.automation.office_pc_on_motion] office_pc_on_motion: Executing step call service
2021-07-11 19:50:42 INFO (MainThread) [homeassistant.components.automation.office_pc_on_motion] office_pc_on_motion: Executing step call service
2021-07-11 19:50:42 DEBUG (MainThread) [pydeconz.gateway] Sending "put" "{'on': True, 'xy': (0.597, 0.387), 'bri': 254, 'transitiontime': 0}" to "core-deconz /lights/10/state"
2021-07-11 19:50:42 DEBUG (MainThread) [pydeconz.websocket] {"e":"changed","id":"71","r":"sensors","state":{"dark":false,"daylight":true,"lastupdated":"2021-07-11T17:50:42.134","lightlevel":29438,"lux":878},"t":"event","uniqueid":"00:17:88:01:06:48:fc:97-02-0400"}
2021-07-11 19:50:42 DEBUG (MainThread) [pydeconz.gateway] HTTP request response: [{'success': {'/lights/10/state/on': True}},
 {'success': {'/lights/10/state/bri': 254}},
 {'success': {'/lights/10/state/xy': [0.597, 0.387]}}]
2021-07-11 19:50:42 INFO (MainThread) [homeassistant.components.automation.office_pc_on_motion] office_pc_on_motion: Executing step call service
2021-07-11 19:50:42 DEBUG (MainThread) [pydeconz.gateway] Sending "put" "{'on': True, 'xy': (0.172, 0.747), 'bri': 254, 'transitiontime': 0}" to "core-deconz /lights/34/state"
2021-07-11 19:50:42 DEBUG (MainThread) [pydeconz.gateway] HTTP request response: [{'success': {'/lights/34/state/on': True}},
 {'success': {'/lights/34/state/bri': 254}},
 {'success': {'/lights/34/state/xy': [0.172, 0.747]}}]
2021-07-11 19:50:42 INFO (MainThread) [homeassistant.components.automation.office_pc_on_motion] office_pc_on_motion: Executing step call service
2021-07-11 19:50:42 DEBUG (MainThread) [pydeconz.gateway] Sending "put" "{'on': True, 'xy': (0.597, 0.387), 'bri': 254, 'transitiontime': 0}" to "core-deconz /lights/35/state"
2021-07-11 19:50:42 DEBUG (MainThread) [pydeconz.gateway] HTTP request response: [{'success': {'/lights/35/state/on': True}},
 {'success': {'/lights/35/state/bri': 254}},
 {'success': {'/lights/35/state/xy': [0.597, 0.387]}}]
2021-07-11 19:50:42 INFO (MainThread) [homeassistant.components.automation.office_pc_on_motion] office_pc_on_motion: Executing step call service
2021-07-11 19:50:42 DEBUG (MainThread) [pydeconz.gateway] Sending "put" "{'on': True, 'xy': (0.597, 0.387), 'bri': 254, 'transitiontime': 0}" to "core-deconz /lights/11/state"
2021-07-11 19:50:42 DEBUG (MainThread) [pydeconz.gateway] HTTP request response: [{'success': {'/lights/11/state/on': True}},
 {'success': {'/lights/11/state/bri': 254}},
 {'success': {'/lights/11/state/xy': [0.597, 0.387]}}]
2021-07-11 19:50:48 DEBUG (MainThread) [pydeconz.websocket] {"e":"changed","id":"49","r":"sensors","state":{"lastupdated":"2021-07-11T17:50:48.823","temperature":2399},"t":"event","uniqueid":"00:17:88:01:08:64:ab:21-02-0402"}
2021-07-11 19:50:51 DEBUG (MainThread) [pydeconz.websocket] {"e":"changed","id":"84","r":"sensors","state":{"lastupdated":"2021-07-11T17:50:51.748","presence":false},"t":"event","uniqueid":"00:17:88:01:09:17:03:ad-02-0406"}
2021-07-11 19:50:56 DEBUG (MainThread) [pydeconz.websocket] {"e":"changed","id":"84","r":"sensors","state":{"lastupdated":"2021-07-11T17:50:56.363","presence":true},"t":"event","uniqueid":"00:17:88:01:09:17:03:ad-02-0406"}
Kane610 commented 3 years ago

It's good to have verified properly that the issue is with sending HS to the light rather than XY