Colors aren't mapping properly for Echo Glow
See original GitHub issueDescribe the bug The color values read from an Echo Glow light do not always produce the same colors when used to turn on the light.
To Reproduce Steps to reproduce the behavior:
- Use Alexa to turn on Echo glow to Green, 100%.
- Wait for values to update. Result:
supported_color_modes: hs
color_mode: hs
brightness: 255
hs_color: 120, 100
rgb_color: 0, 255, 0
xy_color: 0.172, 0.747
friendly_name: name
supported_features: 17
- Change light to different color.
- Use any of hs, rgb, xy, or color name
Green
to turn light on again. - Wait for values to update. Relevant result:
brightness: 255
hs_color: 83.654, 81.569
rgb_color: 172, 255, 46
xy_color: 0.328, 0.597
(Alexa app displays “Custom” for color) However, salmon works via color name, but not using the returned color values, which appear to be for red instead:
hs_color: 0, 100
rgb_color: 255, 0, 0
xy_color: 0.701, 0.299
Expected behavior When using Echo-supported colors, I would expect the colors set from HA to match the colors set via Alexa.
Screenshots None
System details
- Home-assistant (version): core-2021.7.1
- Hassio (Yes/No): No
- alexa_media (version from
const.py
or HA startup): 3.10.6 - alexapy (version from
pip show alexapy
or HA startup): 1.25.1 - Amazon 2FA is enabled (y/n). We will not debug login issues if unanswered: y
Logs
Setting color salmon
:
2021-07-19 11:05:22 DEBUG (MainThread) [alexapy.alexaapi] b***t@g*******g: static PUT: https://alexa.amazon.com/api/phoenix/state returned 200::application/json
2021-07-19 11:05:22 DEBUG (MainThread) [alexapy.alexaapi] b***t@g*******g: set_light_state response: {'controlResponses': [{'code': 'SUCCESS', 'message': None, 'data': None, 'entityId': '0000000000000000000000000000'}, {'code': 'SUCCESS', 'message': None, 'data': None, 'entityId': '0000000000000000000000000000'}, {'code': 'SUCCESS', 'message': None, 'data': None, 'entityId': '0000000000000000000000000000'}], 'errors': []} for data: {"controlRequests": [{"entityId": "0000000000000000000000000000", "entityType": "ENTITY", "parameters": {"action": "turnOn"}}, {"entityId": "0000000000000000000000000000", "entityType": "ENTITY", "parameters": {"action": "setBrightness", "brightness": "10.196078431372548"}}, {"entityId": "0000000000000000000000000000", "entityType": "ENTITY", "parameters": {"action": "setColor", "colorName": "salmon"}}]}
Setting xy_color [0.701, 0.299]
:
2021-07-19 11:12:17 DEBUG (MainThread) [alexapy.alexaapi] b***t@g*******g: static PUT: https://alexa.amazon.com/api/phoenix/state returned 200::application/json
2021-07-19 11:12:17 DEBUG (MainThread) [alexapy.alexaapi] b***t@g*******g: set_light_state response: {'controlResponses': [{'code': 'SUCCESS', 'message': None, 'data': None, 'entityId': '0000000000000000000000000000'}, {'code': 'SUCCESS', 'message': None, 'data': None, 'entityId': '0000000000000000000000000000'}, {'code': 'SUCCESS', 'message': None, 'data': None, 'entityId': '0000000000000000000000000000'}], 'errors': []} for data: {"controlRequests": [{"entityId": "0000000000000000000000000000", "entityType": "ENTITY", "parameters": {"action": "turnOn"}}, {"entityId": "0000000000000000000000000000", "entityType": "ENTITY", "parameters": {"action": "setBrightness", "brightness": "20.0"}}, {"entityId": "0000000000000000000000000000", "entityType": "ENTITY", "parameters": {"action": "setColor", "colorName": "red"}}]}
Setting color green
:
2021-07-19 11:05:50 DEBUG (MainThread) [alexapy.alexaapi] b***t@g*******g: static PUT: https://alexa.amazon.com/api/phoenix/state returned 200::application/json
2021-07-19 11:05:50 DEBUG (MainThread) [alexapy.alexaapi] b***t@g*******g: set_light_state response: {'controlResponses': [{'code': 'SUCCESS', 'message': None, 'data': None, 'entityId': '0000000000000000000000000000'}, {'code': 'SUCCESS', 'message': None, 'data': None, 'entityId': '0000000000000000000000000000'}, {'code': 'SUCCESS', 'message': None, 'data': None, 'entityId': '0000000000000000000000000000'}], 'errors': []} for data: {"controlRequests": [{"entityId": "0000000000000000000000000000", "entityType": "ENTITY", "parameters": {"action": "turnOn"}}, {"entityId": "0000000000000000000000000000", "entityType": "ENTITY", "parameters": {"action": "setBrightness", "brightness": "100.0"}}, {"entityId": "0000000000000000000000000000", "entityType": "ENTITY", "parameters": {"action": "setColor", "colorName": "lime"}}]}
Additional context I know this feature is still in development, and that the way Amazon does things is a huge pain. I really appreciate that you added this and that it’s even possible at all now, so huge thanks!
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (4 by maintainers)
Top GitHub Comments
Ok, lets take one more shot at this. I fixed a brightness handling bug during color conversion and updated my list of colors to match the exact values the Alexa app displays. Salmon now works for me in all directions.
I tested a a bunch of different colors and everything looks good, but please give it a shot as well.
Hmmm, I thought I had, but maybe I hadn’t. I’m not sure when I’ll get a chance to, so sounds like it’s probably best to release for now. Sounds like @blm126’s latest changes are really thorough. Thank you both for working on that, particularly you, Brady! (Speaking of which, it sadly appears that you don’t have any way for me to buy you a coffee. Let me know if that were to change.)