I’m currently trying to use HomeAssistant as bridge between my KNX bus and some HUE lights. What I’m trying to do atm is for HomeAssistant to replicate the state of the HUE lights on the KNX bus. In detail I’m trying to send the “on/off” state (which is working fine) and the “brightness”, which doesn’t work. From my research the xknx light component is sending/processing values from 0-255 for the brightness, thus basically just forwarding the internal HA state value. When I try to do the same by calling the “knx.send” service with the payload “200” (f.e.) the group monitor of the KNX bus is showing me a value of just “1”. It doesn’t matter if I pass the value as int or as struct. I’m using AppDeamon atm to call the service, since it is easier for me to do compared to templates etc (which I’m not familiar with yet). Do I have to convert the brightness values to something else before I pass them as payload to the service, or does the service maybe have a bug? I’m kinda lost atm and am welcome for any input on how to correctly send a brightness/percentage value to the KNX bus. Thanks.
nvm, it was an error on my end. I only sent the brightness value when the light was turned on, and at this point HUE is reporting the value 0. I’m now also correctly monitoring the brightness state and forward this to KNX.
Sorry for the noise and thanks for this awesome piece of software
sorry, missed your reply. I’m using AppDeamon for the KNX/Hue bridge since for me it was the easier approach compared to messing with scripts and templates and what not.
For this to work, you have to tell the KNX component to monitor a certain group address range so that you can catch the KNX signals on the event bus of home assistant. Something like this (you ofc have to adjust the group address range)
no actual plans for this yet since I noticed that I rather use my phone to change the color than getting up from the couch and walk to the KNX switch So that’s really a low priority thing for me in my current smart home configuration.
you mean https://www.mdt.de/Glastaster_Smart.html ? I also have those, but there you can’t pick a specific color but only walk up or down the color spectrum (like dimming from 0 to 100, but for colors). That’s at least what I figured out. That might be rather easy to do.
update - got it working - at least somewhat. I can see the current hue value (color) in my KNX switches and can also change the color via the KNX switches. But at some point the KNX component of HA just dies for yet unknown reasons. Once I found a fix for this, I’ll share my code.
maybe hang on a bit, looks like I messed up KNX->HUE direction when I cleaned up the code (was already working). Will test tonight and publish a new version
I think so. This is what I’m running for some time now. But since I barely change the color via the switch (it’s more convenient from within HA on my phone while on the couch ) I can’t say if the issues are entirely gone now. But feel free to test my latest version:
In order to get it working, you also need the according xknx configuration mentioned in this post
I have a working xknx configuration (i can turn a knx light on/off from HA, and HA sees the status when I turn the same light on/off from a knx switch).
I did add to the configuration :
fire_event: true
fire_event_filter: ["11/*/*"] # in my case
I added your Hue2Knx.py application to AppDaemon/apps folder and edited the apps.yaml with :
I suppose you have restarted HomeAssistant after you changed the xknx config? If so, you should be able to monitor the knx event in the dev tools of your HA installation.
DeveloperTools -> Events -> Listen to event "knx_event"
once you listen and fire something on the KNX bus, you should see the event showing up there.
But I just noticed that the color change seems to be broken as of recently. Could be related to either the Hue bridge update, slightly moved location of the bridge or some change in xknx. Anyway, there is now a huuuuge delay between KNX action and the HUE bulb performing it. Dimming a light sucks as it is now for me (wasn’t perfect before, but it’s terrible now). But since I don’t use it much anymore, I won’t spend time on it atm. I will try to help and answer any questions though and maybe it’s working better for you.
Thanks you da-anda, the telegram is properly received by HA, but for some reason nothing happen. That may be linked to the recent break that you are talking bout.
Anyway thank you very much for your help, I guess that we will need to find a different method in the future.
Cheers