diyhue / diyHue

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

Home Assistant state changes aren't correctly sent to diyhue #835

Open foxy82 opened 2 years ago

foxy82 commented 2 years ago

Describe the bug

Lights in diyhue should update when the light state is updated from Home Assistant. The state should also load correctly on start up / discovery.

Steps to Reproduce

Connect to Home Assistant and discover devices. All are discovered as off even if they are on.

Expected behavior

States should be correctly discovered.

Logs

Docker Info (please complete the following information):

Checklist

Additional context

I am looking into this issue with the other Home Assistant ones.

foxy82 commented 2 years ago

Now I've done the other fixes the state does work - but it is slow and waits for syncs. We can do better than that by pushing changes as soon as they happen.

YellowNest commented 2 years ago

This issue seems to be the same as #795 I don’t know what the progress is on this one.

joeblack2k commented 2 years ago

Same here, opening the app shows a different state the the actual state.

Lights are managed with zigbee2mqtt and homeassistant.

any update on this?

YellowNest commented 2 years ago

still not fixed, tried to ask on slack no response.. installed in in a new environment but nothing..

conclusion: this project doesnt work.

Yeah, I also think this issue has been stale for a long time now. Maybe @Koenkk (the great dev of zigbee2mqtt) can help us with this? 😊

joeblack2k commented 2 years ago

That would be awesome!

mariusmotea commented 2 years ago

Please use MQTT Explorer and show me the message you receive when you turn a light on/off from zigbee2mqtt web interface and also what appear in diyhue logs. For me this is working as expected since it is implemented

https://github.com/diyhue/diyHue/blob/master/BridgeEmulator/services/mqtt.py#L321

GitHub
diyHue/mqtt.py at master · diyhue/diyHue
Main diyHue software repo. Contribute to diyhue/diyHue development by creating an account on GitHub.
nuggie commented 2 years ago

I also have to issue that every change from diyHue is reflected correctly in HomeAssistant but not the other way around. For example: I change the brightness of one light in HomeAssistant - these are the logs in diyHue for this event:

2022-08-19 22:53:45,368 - services.mqtt - DEBUG - MQTT: got state message on zigbee2mqtt/HueEsszimmerTresen 2022-08-19 22:53:45,369 - services.mqtt - DEBUG - b'{"brightness":254,"color":{"x":0.4743,"y":0.4133},"color_mode":"color_temp","color_temp":394,"linkquality":94,"state":"ON","update":{"state":null},"update_available":null}' 2022-08-19 22:53:45,369 - services.mqtt - DEBUG - Cache Hit for HueEsszimmerTresen 2022-08-19 22:53:45,371 - services.mqtt - DEBUG - MQTT: got state message on zigbee2mqtt/HueEsszimmerTresen 2022-08-19 22:53:45,372 - services.mqtt - DEBUG - { "brightness": 254, "color": { "x": 0.4743, "y": 0.4133 }, "color_mode": "color_temp", "color_temp": 394, "linkquality": 94, "state": "ON", "update": { "state": null }, "update_available": null } 2022-08-19 22:53:45,397 - services.eventStreamer - DEBUG - {'creationtime': '2022-08-19T21:53:45Z', 'data': [{'id': '46ee1bd0-74cd-4228-850d-038b2d858cbd', 'type': 'light', 'on': True, 'owner': {'rid': '33951852-721c-59db-afb3-4342643f5448', 'rtype': 'device'}}], 'id': 'b9aefdd1-4196-4338-8dd2-9be13375283e', 'type': 'update', 'id_v1': '/lights/2'} 2022-08-19 22:53:45,398 - services.eventStreamer - DEBUG - {'creationtime': '2022-08-19T21:53:45Z', 'data': [{'id': '46ee1bd0-74cd-4228-850d-038b2d858cbd', 'type': 'light', 'brightness': 100.0, 'owner': {'rid': '33951852-721c-59db-afb3-4342643f5448', 'rtype': 'device'}}], 'id': '4e2e6856-786d-427e-9535-fe4a8658f9c9', 'type': 'update', 'id_v1': '/lights/2'}

but diyHue and also the HueApp shows:

image

The status in HomeAssistant:

image

And I can also say: Yes, the lamp is at 100% brightness

This is the log-entry in zigbee2mqtt:

2022-08-19 23:58:24MQTT publish: topic 'zigbee2mqtt/HueEsszimmerTresen', payload '{"brightness":254,"color":{"x":0.4743,"y":0.4133},"color_mode":"color_temp","color_temp":394,"linkquality":54,"state":"ON","update":{"state":null},"update_available":null}'

Also changed the name in diyHue to the exact same name (without whitespaces), but this doesn't help,

YellowNest commented 2 years ago

Should it matter if whether Home Assistant or Homebridge is used? Personally I use Homebridge and the light state is not working as it should.