This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Dali switch
#1
Hello,
I use LM5CAN also have DALI switch (SR-2422k8).
When a button is pressed, I see it in the monitor (attach.) it can be processed using a script, if I understand correctly.


Could you provide an example of how to handle this click, for example, to the address 5/3/3
I saw this https://openrb.com/docs/dali.htm and https://forum.logicmachine.net/showthread.php?tid=2387 ,but not understand how to right implement this.

Thank you in advance !

Attached Files Thumbnail(s)
   
Reply
#2
Resident script with 0 sleep time. You can check the frame table fields to have different reaction on different button presses.
Code:
if not canxdali then
function callback(frame)
   log(frame)
end

canxdali = require('applibs.canxdali')
canxdali.sethandler('busdata', callback)
end

canxdali.step()
Make sure that you have both latest CANx and CANx-DALI apps with DALI2 message parsing support.
Reply
#3
(06.02.2023, 06:19)admin Wrote: Resident script with 0 sleep time. You can check the frame table fields to have different reaction on different button presses.
Code:
if not canxdali then
function callback(frame)
   log(frame)
end

canxdali = require('applibs.canxdali')
canxdali.sethandler('busdata', callback)
end

canxdali.step()
Make sure that you have both latest CANx and CANx-DALI apps with DALI2 message parsing support.

Thanks for your quick answer.

I'm getting the frame in the log but still not understand is any function which exist to take value from this? Types are described here https://openrb.com/docs/canxdali-dali2.htm , but it is not entirely clear to me which function is needed to be used to extract them.
Or need to write own function which take a value from this frame?

Attached Files Thumbnail(s)
       
Reply
#4
What kind of value do you expect to get? The push-button only provides its state in the "button" field. You can use instance number to distinguish different push-buttons.
Reply
#5
I'm expecting to get the state of whether the button is pressed or not, the type of press (short press, long press) and the instance number.
At the moment, the syntax of the call is not clear, it should look like:

frame.pressed() or frame.instancenumber() or something similar?
Reply
#6
Frame is a Lua table, so:
frame.button is the button state
frame.instancenumber is the instance number
Reply
#7
Thank you so much, everything works perfectly!
Reply
#8
Hello, could anyone provide a way how to address dali-2 devices?
I have one sensor now attached, but if i had more, how do i distinguish between them?

DALI log from such sensor looks like that:
DALI logs 25.05.2023 21:34:21

* table:
["rawdata"]
* string: s��
["sensor"]
* string: movement
["len"]
* number: 3
["instancenumber"]
* number: 0
["movement"]
* bool: true
["frametype"]
* string: event
["lineid"]
* number: 0
["instancetypename"]
* string: occupancy sensor
["msgprio"]
* number: 255
["frombus"]
* bool: true
["instancetype"]
* number: 3
["data"]
* string: ��
["event"]
* number: 11
["state"]
* string: still vacant
["type"]
* string: busdata
["nodeid"]
* number: 1
["transid"]
* string:
Reply
#9
DALI2 addressing is not supported yet. You need to use an external tool to perform addressing of DALI2 devices.
Reply


Forum Jump: