I’m using Osram Dali Pro 2 IOT controller to control lights at my office. I also have a few lights/sensors running on ewelink that I’ve setup on HA. What I want to do is get all the controls on HA and the controller I’m using supports mqtt.
I successfully setup the connection and I’m able to turn on/off lights on my dali controller through HA dashboard, but I’m facing 2 issues, I’m not getting the status of lights updated on HA dashboard and I’m not able to control the brightness level of my lights. Below is code from my configuration file for my conference room.
I’ve tried everything I could but I’m not able to figure out answers to both of these. During my debugging process I found out that the payload that is being sent when I turn on/off my lights is what my dali controller expects, but when I change the brightness level it is not.
This is how the payload is expected to be, and it works fine with on/off.
But, when I try to alter brightness using HA dashboard, this is what I receive on mqtt.
Message 10 received on DALI-PRO-IoT/DALIPRO2-860003FA/groups/3/target/level at 9:01 PM:
{
"value": 100
}
Message 9 received on DALI-PRO-IoT/DALIPRO2-860003FA/groups/3/target/level at 9:01 PM:
51
For some reason, I’m receiving 2 messages even though I just turned the slider to 51%. Any help I could get on this would be appreciated.
P.S. I’m new to HA.
I tried your code, the lights didn’t dim, state didn’t get updated moreover the lights have also stopped turning on and off. I think the controller isn’t understanding just the value and is also expecting the full format.
Another thing is that I’m still getting 2 messages on MQTT when I try to set brightness level, one being the level I’m trying to set and other one being 100.
Message 12 received on DALI-PRO-IoT/DALIPRO2-860003FA/groups/1/target/level at 3:22 PM:
100
QoS: 0 - Retain: false
Message 11 received on DALI-PRO-IoT/DALIPRO2-860003FA/groups/1/target/level at 3:22 PM:
59
QoS: 0 - Retain: false
I think what you are seeing on mqtt is the messages you are sending as they seem to match exactly your format as it changes. It looks like your lights are expecting a json value like this (esp as it stopped working when you changed payload on/off. As such, you prob need this config.
It is not clear if you are getting any response, so i wonder if this is on a different topic. As such, not sure how you see current state.
Edit: to explain the 2 messages you are seeing, default is to send the on command followed by the setting. You would need to set the below to brightness also.
on_command_type string (optional)
Defines when on the payload_on is sent. Using last (the default) will send any style (brightness, color, etc) topics first and then a payload_on to the command_topic. Using first will send the payload_on and then any style topics. Using brightness will only send brightness commands instead of the payload_on to turn the light on.
The payload needs to match the value returned from the state_value_template, it should work. I have no idea how your version is working when you have no level attribute, yet that’s how you’re pulling the state. Please share the contents of your DALI-PRO-IoT/DALIPRO2-860003FA/groups/1/state/level topic.
The state is now getting updated, for some reason when I tested it in afternoon it wasn’t but now state is getting updated. Though it is not updating the state when home assistant is restarted but I think I can figure that one out.
This method solved the problem of brightness, but now the switch on/off buttons are not working. Also, the state is now getting updated.
This is the current code I’m using -
Please post the contents of this topic DALI-PRO-IoT/DALIPRO2-860003FA/groups/1/state/level. We can’t help create the templates needed for on/off without it. Same for the slider in the UI, which won’t work for you.
I’m not sure why you glossed over my request for this information before.
Ok, obviously you have to send 100 or 0 for on and off before sending the brightness level. As such, @petro answer in nearly right. As it worked when you had a json value in payload on/off, go back to that. Therefore:
The state value template is outputting values between 0 and 100 only defined by the template itself. Therefore the payload on and payload off values need to match what the template outputs, not the full json.
This will most likely work the best without modifying payload_on or off so that any value above 0 shows the light being on.
Ok, but it is clear from the discussion that sending a payload of 100, instead of {"value": 100} is not working.
The OP originally had payload_on: {"value": 100}, payload_off: {"value": 0} and this worked to turn it on/off. You keep saying set it to just payload: 100 and it does not work.
How is your example sending the correct message. What am I missing?
When I use this code, I’m able to get brightness working but the light on/off is not working. Brightness status is working, on/off status is also getting updated perfectly when I change using dali mobile app.
When I use this code, I’m able to get brightness working and light off is also working, light on is not. Brightness status is updating, on/off status is not updating when I turn off the light using the HA dashboard or the mobile app.
Another issue that I’m facing is that the status is not getting updated when I restart the home assistant, so I’m not able to control anything using dashboard unless I change it using app first, which updates that status. This is how the dashboard looks on restart -