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 interface dimming
#15
(19.10.2015, 06:25)admin Wrote: Have you tried this script?
http://forum.logicmachine.net/showthread.php?tid=13

thanks, that works for me.

I added a resident script for dimming:
Code:
lastDali = 1

for i = 0, lastDali do
 dimObjects = grp.tag('DALI_DIM_'..i)
 for key, object in pairs(dimObjects) do
   dimmer = object.data
   step = bit.band(dimmer, 0x07)

   if step ~= 0 then
     lvObjects = grp.tag('DALI_LV_'..i)
     for key, lvobject in pairs(lvObjects) do
       up = bit.band(dimmer, 0x08) ~= 0
       value = lvobject.data

       if up then
         newvalue = value + 5
       else
         newvalue = value - 5
       end

       -- clamp between 0 and 100
       newvalue = math.min(newvalue, 100)
       newvalue = math.max(newvalue, 0)

       if newvalue ~= value then
         lvobject:write(newvalue)
       end
     end
   end
 end
 
end

os.sleep(0.1)

And i added a script for setting the status
Code:
require('user.dali')
lastDali = 1

for i = 0, lastDali do
 res = dalicmd('internal', 'queryactual', { addrtype = 'short', address = i })
 if res then
   curr = math.floor(res:byte() / 2.54)
   
   -- set target level status
   targetObjects = grp.tag('DALI_SLV_'..i)
   for key, object in pairs(targetObjects) do
     prev = object.data
     if curr ~= prev then
       targetObjects:response(curr)
       end
   end
   
   -- set target on/off status
   targetObjects = grp.tag('DALI_STAT_'..i)
   for key, object in pairs(targetObjects) do
     prev = object.data
     if (curr>0) ~= prev then
       targetObjects:response( curr > 0 )
       end
   end
   
 end
end

os.sleep(0.1)

Next todo is a scene handler for DALI, see other thread Smile
Reply


Messages In This Thread
Dali interface dimming - by PassivPluss - 29.07.2015, 17:38
RE: Dali interface dimming - by PassivPluss - 01.08.2015, 18:59
RE: Dali interface dimming - by Peter - 03.08.2015, 15:03
RE: Dali interface dimming - by edgars - 04.08.2015, 10:10
RE: Dali interface dimming - by PassivPluss - 15.09.2015, 03:04
RE: Dali interface dimming - by managementboy - 16.09.2015, 10:48
RE: Dali interface dimming - by admin - 18.09.2015, 06:40
RE: Dali interface dimming - by PassivPluss - 18.10.2015, 05:23
RE: Dali interface dimming - by admin - 19.10.2015, 06:25
RE: Dali interface dimming - by gjniewenhuijse - 20.10.2015, 11:53

Forum Jump: