DALI interface integration in python-dali
Martijn Hemeryck last edited by Martijn Hemeryck
Update: tl;dr: I am really struggling to just getting started with the axon S605. I tried running a sort of "commissioning" with the unipidali implementation you propose, but I can't even read any voltage level responses from any of the outputs (simple voltage reader though, I don't have a scope). Is there any low-level documentation out there for me in order to be able to start programming against it?
Just recently received by axon S605 for DALI interfacing and I'm currently looking into the scripts you did write for controlling it; https://git.unipi.technology/UniPi/unipi-python-lighting/tree/master/UnipiDali
Being a python dev myself, I was thinking of tweaking it a bit; I did notice there was an open issue on the upstream python-dali repo related to integrating a unipi-based DALI interface in there: https://github.com/sde1000/python-dali/issues/48
I was wondering how you feel about this. I haven't done any actual coding on it, but I suppose my solution would be based heavily on yours. Specifically note that they have an LGPLv3 license, so that could be an issue.
Martijn Hemeryck last edited by Martijn Hemeryck
Did some reading and some (real rough) coding already; https://github.com/sde1000/python-dali/compare/master...mhemeryck:unipi and did try to set up all the hardware.
For now, I can't detect anything on the bus, so I'd like to check a few things:
- hw setup: does it matter what kind of wiring I use to connect the DALI bus? I currently used a 8-wire SVV cable (0.8mm2 diameter)
- wiring: I notice there are 4 "busses" on the axon S605, each having 2 connectors. I guess each of the 4 are for one set of 64 devices and that you have 2 connectors such that you can loop the signal through the bus. For my setup, with only one test LED driver, I guess it's OK to just use one of the connectors (no need to create a loop? Not even sure that's safe ...)
Implementation; I'm currently just testing the "commissioning". As I understood it, this means a first phase in which the axon scans the bus, find devices and assigns short addresses.
The particular code I'm using is (taken from your repo):
bus_driver = SyncUnipiDALIDriver(bus=0) logger = logging.getLogger("UnipiDALIDriver") bus_driver.logger = logger bus_driver.debug = True light_bus = Bus(name="1_01", interface=bus_driver) light_bus.assign_short_addresses() print(light_bus._devices)
i.e. I just check whether any devices were found. Does this make sense? Is the number of the buses 0-based?
Another implementation note: my understanding is that this driver just does a translation between a modbus (TCP) server that's running on the device. Is it also possible to query the bus device directly, i.e. via a linux block device handle? (is that safe?). Also, how does the mapping modbus (TCP) / DALI driver work?
Thanks in advance,
Hi @martijn-hemeryck, just a quick question - do you have the DALI power supply connected to the bus? The topology of the DALI has to be like this:
@martin-kudláček Thanks for your reply!
I indeed do not have a separate DALI power supply, as I was under the impression that this would already have been provided by the Axon module. Do you have some suggestions of a proper DALI-bus specific power supply? Is a single power supply for all 4 busses OK, or does each bus need it own power supply?
Anyways, glad to learn something's just off with the setup I have.
Martin Kudláček last edited by Martin Kudláček
@martijn-hemeryck Each channel has to have its own power supply because otherwise you would connect all the buses together.
We don't have any trusted DALI PSUs, but Meanwell is my personal brand of choice. The only thng you need to select is the wattage and that can be deduced from the devices which you intend to connect to the bus. Some devices are powered only through the bus (switches,..), some devices have their own power supply connections (typically the more power hungry - lights and so on)
Edit: The DALI PSU is a special power supply, which powers the transcivers in the DALI devices connected to the bus and the maximum current for the bus is 250mA. The reason, why we didn't integrate the PSU into the Axon S605 is the size and the convenience of having the external power supply. The power supply should be in the middle of the bus and when the PSU dies, it is easier to replace it instead of replacing the whole PLC.
@Martijn-Hemeryck See updated answer.
@martin-kudláček yeah, I guess it does indeed make sense to have a separate power supply from a network point of view. I'll try again as soon as I will be able to get one.
Apart from the hardware setup, do you have any further documentation on how to address the DALI busses? From what I understand from your python implementation, you just have a modbus server running which you use to update specific registers. I guess this should be good enough for now, but given I'd like to translate between MQTT events and the DALI bus, I would also be interested in learning how to directly interface with it.
FYI: got my DALI bus driver in the mail today and did the full setup; managed to get everything up and running!
Will keep you posted on any further development wrt to the upstream python-dali library / any MQTT front-end I'd like to add.
Hi @martijn-hemeryck, those are great news! I'm glad we were able to put it together, together:) I'm looking forward for your results.