18.09.2024, 09:26
Hi!
I have phase dimming actuator in KNX panel and I need to control them with Lutron switch.
The Lutron switch has 4 buttons; on/off and dim up/down.
I have handled the on/off part but I want to seek the best way in LM to imprement the dimming part.
From the TCP message coming from Lutron, I know when the button is pressed and released.
What I want to do is to dim up/down for 1 step(6%) with short press, and keep dimming up/down with long press until the release, like KNX wall switches.
As LM needs to be the one to distinguish between long press and short press, this is what I have done.
I created two types of resident script.
・Script to check the Lutron message...when I get the button press message I set storage ('Button1', 'up'), ('Button1', 'down'), and when I get the button release message I set storage ('Button1', 'stop'). Script interval = 0
・Script to check the Button1 storage variable....if the value is 'up' or 'down', do the relative dimming for 1 step and if the value is 'stop', do nothing. Script interval = 1 sec
Is there any better, effifient way to handle this ? I don't want to pressure LM to get high load.
I have phase dimming actuator in KNX panel and I need to control them with Lutron switch.
The Lutron switch has 4 buttons; on/off and dim up/down.
I have handled the on/off part but I want to seek the best way in LM to imprement the dimming part.
From the TCP message coming from Lutron, I know when the button is pressed and released.
What I want to do is to dim up/down for 1 step(6%) with short press, and keep dimming up/down with long press until the release, like KNX wall switches.
As LM needs to be the one to distinguish between long press and short press, this is what I have done.
I created two types of resident script.
・Script to check the Lutron message...when I get the button press message I set storage ('Button1', 'up'), ('Button1', 'down'), and when I get the button release message I set storage ('Button1', 'stop'). Script interval = 0
・Script to check the Button1 storage variable....if the value is 'up' or 'down', do the relative dimming for 1 step and if the value is 'stop', do nothing. Script interval = 1 sec
Code:
local array = {'2/4/3', '2/4/2'}
-- Loop through the array
for i = 1, #array do
if storage.get(array[i]) == 'up' then
grp.write(array[i], 14) --dim 1 step up 6 %
elseif storage.get(array[i]) == 'down' then
grp.write(array[i], 6) --dim 1 step down 6 %
end
end
Is there any better, effifient way to handle this ? I don't want to pressure LM to get high load.