Logic Machine Forum
Dali switch - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: CANx (https://forum.logicmachine.net/forumdisplay.php?fid=23)
+--- Thread: Dali switch (/showthread.php?tid=4555)



Dali switch - Nikita - 04.02.2023

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 !


RE: Dali switch - admin - 06.02.2023

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.


RE: Dali switch - Nikita - 06.02.2023

(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?


RE: Dali switch - admin - 07.02.2023

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.


RE: Dali switch - Nikita - 07.02.2023

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?


RE: Dali switch - admin - 07.02.2023

Frame is a Lua table, so:
frame.button is the button state
frame.instancenumber is the instance number


RE: Dali switch - Nikita - 07.02.2023

Thank you so much, everything works perfectly!


RE: Dali switch - LKBA - 25.05.2023

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:


RE: Dali switch - admin - 26.05.2023

DALI2 addressing is not supported yet. You need to use an external tool to perform addressing of DALI2 devices.