Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Device instance type #130

Open
ptorrent opened this issue Nov 1, 2023 · 4 comments
Open

Device instance type #130

ptorrent opened this issue Nov 1, 2023 · 4 comments

Comments

@ptorrent
Copy link

ptorrent commented Nov 1, 2023

Hello !

What would be the function to call to get the device instance avaiable ?

QueryInstanceType ?

I've device that have implement an occupancy sensor (3) and a light sensor (4) in the same product. How can I know that this device has those sensor from dali bus ?

Thanks for your answer !

@jktjkt
Copy link
Contributor

jktjkt commented Nov 1, 2023

Yes, QueryInstanceType is what gets the workd done, but since it's very important to know the instance type up front, even for basic stuff such as correctly printing the bus traffic, this library has some helpers which make it much easier to build up this mapping. It's implemented in dali.device.helpers.DeviceInstanceTypeMapper, and the usage is as simple as shown in examples/async-buswatch.py.

@ptorrent
Copy link
Author

ptorrent commented Nov 1, 2023

Got it, thakns for the answer.

Actually if I use QueryInstanceType for device short address 0 (instance 0), this is the buffer I send:

0x01 0x00 0x80 and the answer => 1

if now I send address 0 and instance 3:
0x01 0x03 0x80 and the answer => 4

Not sure to correctly understand the answer of the device

Is there a special way to parse the answer ?

@jktjkt
Copy link
Contributor

jktjkt commented Nov 2, 2023

Well, the library implements this discovery already, and it should do The Right Thing™. It's indeed working as designed for the control devices that I have (all of which are multi-instance), which are Lunatone DALI-2 MC push-button couplers, the Lunatone DALI-2 ROT Touch buttons-and-click-wheel thingy, as well as the Lunatone DALI-2 CS movement and light level sensors. If you just let this autodiscovery run, you won't have to parse these replies in your code. Note that if you do not let this autodiscovery do its magic, then the packet sniffer/printer that's built into this library won't be able to decode the event frames properly, and it will just dump info about generic events, and also your callbacks won't see the decoded packets. Apparently, you are not doing that for some reason -- why so?

Now, if a device says that its instance number 3 is of a device type 4, then that means that it's a light sensor (part 304). If it says that its instance number 0 is of device type 1, then that means that it's a push button (part 301). IIRC the instance numbers are assigned in a continuous range, so if you have instance number 3, there should also be instance no. 0 (that you mention in this bugreport) and 1 and 2 (which you did not mention).

I guess I'm not sure what exactly you're asking for?

@ptorrent
Copy link
Author

Thanks for your answer, that was a lack of dali knowledge from my part !

Thanks again for your support

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

No branches or pull requests

2 participants