diyhue / diyHue

Main diyHue software repo
https://diyhue.org/
Other
1.52k stars 274 forks source link

Controlling brightness and color of Home Assistant light entities does not work #894

Open jclsn opened 1 year ago

jclsn commented 1 year ago

Describe the bug

When using the Home Assistant API, it is neither possible to control the brightness or color of the lights. You can only control the on/off state.

Steps to Reproduce

Expected behavior

I would expect diyHue to be able to control the brightness or color.

Logs

Docker Info (please complete the following information):

Checklist

Additional context

jclsn commented 1 year ago

Here is one log when trying to change the brightness. Will try to have a look at the code as well

192.168.184.84 - - [26/Feb/2023 20:52:40] "PUT /api/hueess5eb60e11edb2bbe45f0126b335/lights/12/state HTTP/1.1" 200 -
INFO:werkzeug:192.168.184.84 - - [26/Feb/2023 20:52:40] "PUT /api/hueess5eb60e11edb2bbe45f0126b335/lights/12/state HTTP/1.1" 200 -
jclsn commented 1 year ago

So the debug mode shows

192.168.184.84 - - [01/Mar/2023 21:26:35] "PUT /api/hueessf8b87411eda000e45f0126b335/lights/11/state HTTP/1.1" 200 -
2023-03-01 21:26:35,679 - services.eventStreamer - DEBUG - {'creationtime': '2023-03-01T21:26:35Z', 'data': [{'id': '3f5c6dc4-3d0f-505f-aaaa-e248a87f1be8', 'id_v1': '/lights/11', 'identify': {}, 'metadata': {'archetype': 'sultan_bulb', 'name': 'Lampe beim Fernseher'}, 'product_data': {'certified': True, 'manufacturer_name': 'Signify Netherlands B.V.', 'product_archetype': 'sultan_bulb', 'product_name': 'Hue color lamp', 'software_version': '1.90.1', 'model_id': 'LCT001'}, 'services': [{'rid': '60bb0b0d-758b-43ee-ada1-45d1481cfc2c', 'rtype': 'light'}, {'rid': '9697d411-3f86-5e4b-92b0-a571cc2be73a', 'rtype': 'zigbee_connectivity'}, {'rid': '07dba3ae-b44c-5177-ac3c-c30a7e161a7e', 'rtype': 'entertainment'}], 'type': 'device'}], 'id': '54bf0774-37fe-4456-8a4e-863d9d780b15', 'type': 'update'}

here is a successful API call with curl to change the brightness

❯ curl \
  -H "Authorization: Bearer mytoken \
  -H "Content-Type: application/json" \
  -d '{ "entity_id": "light.lampe_beim_fernseher_light", "brightness": 15  }' \
  https://home-assistant-ip:8123/api/services/light/turn_on
[{"entity_id":"light.lampe_beim_fernseher_light","state":"on","attributes":{"min_color_temp_kelvin":1901,"max_color_temp_kelvin":6535,"min_mireds":153,"max_mireds":526,"effect_list":["colorloop"],"supported_color_modes":["color_temp","xy"],"color_mode":"xy","brightness":15,"hs_color":[33.176,100.0],"rgb_color":[255,141,0],"xy_color":[0.595987,0.387976],"off_with_transition":false,"off_brightness":null,"icon":"mdi:lightbulb","friendly_name":"Lampe beim Fernseher","supported_features":44},"last_changed":"2023-03-01T21:07:48.980567+00:00","last_updated":"2023-03-01T21:30:07.568958+00:00","context":{"id":"01GTFHA888N2KC7WW02GK7T9JE","parent_id":null,"user_id":"b81ec0658c0f4adebf458191adc26c00"}}]

Seems like something is wrong with the endpoint that is being called, but from the code it is not clear to me. It looks correct to me there.