15.02.2021, 10:44
Hi here is example script which does what you ask for, you can convert yours same way.
Code:
--// when input = 1 then output (100%) ; when input = 0 then output (25%)
onValue = 255 -- remember that when object will have scale dpt then values are from 0-100
offValue = 64
----------------------------------------------Optional change-----------------------------------------------
PIR_name = 'PIR'
DALI_name = 'SetValue'
-----------------------------------------------------------------------------------------------
DaliOutName, found = string.gsub(grp.alias(event.dst), PIR_name, DALI_name)
myobject = grp.find(DaliOutName)
log(myobject)
if event.getvalue() then
if found == 1 then
if grp.find(DaliOutName) then -- check if output group exists
grp.write(DaliOutName, onValue) --//
else
alert('Group address '..DaliOutName ..' does not exist' )
end
else
alert('Group address has not correct name %s', event.dst)
end
else
if found == 1 then
if grp.find(DaliOutName) then
grp.write(DaliOutName, offValue) --//
else
alert('Group address '..DaliOutName ..' does not exist' )
end
else
alert('Group address has not correct name %s', event.dst)
end
end
-----------------------------------------------------------------------------------------------
------------------------------
Ctrl+F5
Ctrl+F5