sde1000 / python-dali

Library for controlling DALI lighting systems
Other
150 stars 71 forks source link

Using python-dali as a slave, not a master #125

Closed hollymcr closed 1 year ago

hollymcr commented 1 year ago

Is it possible to use python-dali as a slave, rather than a master?

That is, could I use it to mimic one or more light fittings, connected to a real DALI line, responding to DALI commands and status queries from a real DALI master?

What I would like is to create a test program that mimics (up to) all 64 DALI lamps on a line, for use when testing the configuration of a DALI gateway. It would allow me to mark any individual lamp as present/missing/failed/etc and show the light level that had been sent from the master. It would allow me to confirm that my gateway configuration does what I expect without rigging 64 lamps up on a bench.

(If not, are there similar libraries which might? Maybe there are libraries that python-dali uses for testing without hardware present?)

Issues likely isn't the right place for this but I couldn't see a mailing list or other option, apologies if I missed it,

sde1000 commented 1 year ago

Interesting question!

It's certainly not what the library was intended to do, but it's probably not impossible.

There's a partial implementation of DALI gear used for testing the library without hardware present; it's in dali/tests/fakes.py. It is not a standard-compliant implementation!

You would have to hook it up to a driver for an interface that's able to listen for forward frames and send backward frames. I don't know which interfaces support this. I can't see any mention of being able to send backward frames in the LUBA protocol documentation, for example.