Skip to content

Conversation

@jktjkt
Copy link
Contributor

@jktjkt jktjkt commented Aug 10, 2023

I have no idea if this actually reaches the physical DALI bus, but I've checked that the bus watcher picks up the traffic. So, this can be already used to persuade some real code that's connected to the real DALI bus that a sensor "sent us something".

I have some internal code that switches my DALI lights on and off based on a DALI movement sensor. With this patch in place, I can simulate this movement, and my light went on, as if someone really walked in our hallway:

from dali.device.occupancy import OccupancyEvent
x = OccupancyEvent(short_address=45, instance_number=0,
  data=OccupancyEvent.EventData(movement=True, occupied=True))
await dev.send(x)

Caveat: the usual bits about addressing of event messages apply (I tried to write this up at electronics stackexchange). In this library it's done via DeviceInstanceTypeMapper, so in this example code it was important to ensure that there's really a physical control device on the bus at address A² = 45 which really has an instance no. = 0 which reports that it implements part 303, occupancy sensor. The other way would be faking that, of course. The root cause is that these 8-bit frames are too short to encode all the event info, and something has to perform this discovery up front, or has the knowledge of "hey, A² X, instance Y is a movement sensor" that's provided out-of-band.

Bug: #126

@jktjkt jktjkt marked this pull request as ready for review August 10, 2023 19:36
@jktjkt
Copy link
Contributor Author

jktjkt commented Aug 10, 2023

I can confirm that this indeed hits the bus (tested by Lunatone DALI-2 CS set as an application controller).

@sde1000 sde1000 merged commit 8276c9c into sde1000:master Aug 10, 2023
@jktjkt jktjkt deleted the backward-frames branch July 26, 2024 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants