DALI lighting system integration

Oh my god. That was it.
I added a Client ID and now I get a connection.

Now I have to find out how to configure the “MQTT Set Topic” & the “DALI Access” Section so that my DALI Device will show up in HA…

Hello Francesco,

I managed to connect to the Mosquitto Broker but I am not able to see my device in Home Assistant.

I posted my configuration here:

If it is not too much hassle, could you review it?

Thank you.

Hi,
I will check this evening, unfortunately I’m very busy in these days …
But I’ll let you know

Her am I,
First you have to activate the dali addresses that you want to scan (The converter scan the dali bus continuously in order to know the devices status).


After this, you have to set the MQTT Set Topic:
Here my example
For each address, you need to specify the topic (in my case : dali2mqtt/name of the light)
retained
the type of command that trigger the comunication with the broker (in my case on_change)
And the address

Than double click in the in the template column to set the JSON output (this output will be send to the brocker.
in my case : { “channel”: $CHANNEL$, “adv”: $ADV$ }
and here you see how will be on the broker :

Immagine 2023-08-24 212823

you can choose also to send others parameters, see the table below in the template page.

Now you should have a correct writing of the parameters in the broker.

If you want to change the light parameter, you have to subscrive the Converter to a topic (in my case : dali2mqtt)

After that, you can send information to the broker as you prefer, in my case I use NODERED:

Immagine 2023-08-24 213305

Hope that will help you.

If you need more assistance, let me know.

That helped quite a lot thank you. I now can control the light.
However, now I have a problem syncing the light state (on/off, brightness) with the light entity in home assistant.
I have created a topic with the following payload:

{"state": "$STATUS$", "brightness": $ADV$}

and the brightness is updated fine.
However for ON/OFF the ADF Module sends 4/0 but HASS is expecting “ON”/“OFF”.
How can I substitute the 0 with OFF and the 4 with ON?

Thanks for your help.
Akio

You have to use template

Hi,
I use this workaround, with a custom template sensor:

- name: "SENSOR-NAME"
  state_topic: "ADF-MODULE_topic"
  value_template: >
    {% if value_json.state == 0 %}
      Off
    {% elif value_json.state == 4 %}
      On
    {% else %}
      Unknown
    {% endif %}

hope this can help you! :upside_down_face:

Hi Francesco,
thanks to your post I’ve been able to get the device to publish to MQTT, but only OnTimer, it never publish the values when they change (I’ve ticked the “OnChange” option).
Also, I can’t change the values with MQTT messages. You’re publishing the JSON {"channel":41,"value":144} to the topic dali2mqtt, but where did you set that topic?
Thanks!

Edit: ops, I’ve missed the MQTT Subscribe section. Half a problem solved!

Hi @andrex ,
Now you can see the topic for each light?
The value (brightness) of the light can be changed by publishing {“channel”:41,“value”:144} on the main topic (not into the light topic).
I can’t help you so much because I removed this device and I have switched to another system.

@flayy73 Does the lunatone work better? I got the ADF and it sucks as the support for Dali2, specifically DT8 lights is non existent :-/

Thanks. I’ve bypassed the value not updating on change using a 500ms for the timer.
@lhoracek does the “OnChange” work for you?

@lhoracek , the lunatone works great. Very easy to connect to HA (I use node red). For the DTS8, I just have DT6 on my system, but from the supplier specs seems it works. (Digital Illumination Interface Alliance).

1 Like

@andrex Did not get to test it properly. I’ve disabled the scan etc to avoid congestion on the bus. At least until I figure out if the DT8 gear is controllable to some extend (I put CCT gear to every light in my house :smiley: ). But if not, I’m going to be switching to Lunatone and leaving this for garage use where I’ll be most likely using single color lighting.:slight_smile:

What are those?

Controlled Color Temperature

This sounds interesting. I had also gotten the ADF and didn’t get it to work, since it congested the bus.

Which Lunatone device are you using? Are you able to control single addresses (i.e. control several lights individually on the same Dali bus)? Is the status of the lights updated in HA when the light is controlled by a different device on the Dali bus, e. g. a dimmer? Is the lunatone without Dali power supply?

In case anybody still needs it I am posting my MQTT light template code that I use to control my lights connected via the ADF device.
Please note that the converter is quite slow at posting update messages to MQTT and therefore the light status in HA can take a second or two to update, I am contemplating writing a small bridge in node.js similar to Z2M in order to better expose the ADF device to HA and include stuff such as auto discovery but no time frame on that sadly.

Setup the light in the ADF software
Follow what flayy73 has posted above about setting up the converter and note the topic names you use for each light.

You will need to add the following into your configuration.yaml and each light will require an entire “light:” section of its own.

#DALI2MQTT configuration
mqtt:
  light:
  - name: "Living Room 1 Light"
    unique_id: "living_room_1_light"
    command_topic: "dali/main"
    state_topic: "dali/main/livingroom1/status"
    state_value_template: >
      {% if value_json.adv > 0 %}
      on
      {% else %}
      {"channel": 64, "value": 0}
      {% endif %}
    availability_topic: "dali/main/status"
    payload_available: "online"
    payload_not_available: "offline"
    payload_on: "on"
    payload_off: '{"channel": 64, "value": 0}'
    brightness_scale: "254"
    brightness_state_topic: "dali/main/livingroom1/status"
    brightness_value_template: "{{value_json.adv}}"
    brightness_command_topic: "dali/main"
    brightness_command_template: '{"channel": 64, "value": {{value}}}'
    on_command_type: "brightness"
    qos: 1
    optimistic: false

What needs adapting in the code posted above for a particular light

  1. change name to an appropriate name for your light
  2. change unique_id to something well… unique
  3. state_topic and brightness_state_topic need to match the topic you set up for the light in the ADF software
    4.availability_topic should point to a Last-Will-Testament (LWT) topic that is set to online by publish on connection section in the ADF software communication window so that the MQTT broker labels the device as offline if it is not connected to help HA mark the lights as not available in case of disconnect.
  4. All references to "channel": 64 need to change to the channel you actually want to send brightness commands to, the channels are listed in the ADF manual.

Also for people having weird behavior with the ADF converter I also had issues with random lights turning on and changing brightness, the solution for me was to avoid DALI device 0 & 1 and use only use 2 and up (had to adjust all of my ballasts device IDs) and that cleared all issues I was having.

Which Lunatone device are you using?

Dali-2 IoT (link)
In this link you can find the user manual, very well done…

Are you able to control single addresses (i.e. control several lights individually on the same Dali bus)?
Yes,
you can control singol address, groups, zones. You can switch on/ff, adjust brightness, adjust color (RGB), adjust white temperature K°, color with WAF, or X,Y

Is the status of the lights updated in HA when the light is controlled by a different device on the Dali bus, e. g. a dimmer?

The device works with websocket. You can send data to the socket by any interface (nodered, home assistant etc) to control a device and you can receive light status (every time its change) .

Is the lunatone without Dali power supply?

Yes is without power supply

I notice even 3 or 4 seconds delay most of the time and ADF support blames the slowness of the DALI protocol :frowning:

And update from my side. I got an Atios KNX Bridge for testing. It works perfectly fine for my setup and is super easy to setup and configure, including integration in HA via HomeKit (Note: I do not have any other HomeKit application running. HomeKit is only used to integrate the Atios Bridge in HA). I can control Dali lights via HA or any other controller device (e.g. Lunatone rotary dimmer). And I get a feedback on the state of the ballasts no matter by which device they are controlled. The Bridge is called “KNX”, but there’s also a Dali integration.

As for now, the feedback is only on on/off but no brightness values yet. However, Atios say that they have that feature on the roadmap for this spring.

My setup:

  • Dali (not Dali2), i.e. a dimmer sends a message to a certain address and the corresponding ballast reacts. There is no central master involved that could feed back the states of the ballasts to a third party system like HA
  • Several Dali ballasts (lights) in several groups on one Dali line, i.e. broadcast-only controllers wouldn’t work
  • Dali power supply already in place, i.e. any additional device like a gateway to HA must be without power supply
  • Several kinds of controllers: rotary dimmers by Lunatone, Dali Enocean gateway by Eltako
  • Lights / ballasts with on/off/brightness only, i.e. no color

A remark on the HA integration: The Atios Bridge has a nice web interface. You configure your Dali ballasts via that interface first (i.e. a handful of clicks per device, no struggle with code/JSON/templates or whatsoever). Then you pair the Bridge to HA via the HomeKit integration (i.e. typing the pairing code from the Bridge into HA). And then your Dali ballasts are automatically discovered by HA and added as devices. Done. So really easy and straightforward, no need to code or template.

Also nice: the Atios Bridge can be powered via external power supply or PoE. The latter might be easier for many people since you do not need to touch any AC power parts.

You can read between the lines that I’ve become a fan of the Atios Bridge. Especially after having gone through the struggle and dozens of hours of trial and error with other solutions like the ADF, which I never got to work 100%.

The two aspects I recommend having a closer look when you think about getting an Atios Bridge: Does it work for you in case you have color control? And if you absolutely rely on dim value status feedback (not just on/off), you might want to wait until they release it for real in a few weeks/months.

Disclaimer: Atios gave me a device for testing (which I’m going to purchase now). I met them personally, since I live only a few minutes away. Very nice guys! However, I’m not affiliated with them in any other way and I have not known them before.