Logic Machine Forum
Dali interface dimming - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10)
+--- Thread: Dali interface dimming (/showthread.php?tid=51)



Dali interface dimming - PassivPluss - 29.07.2015

Hi

I have put up an binary switch from Schneider to controll group adress that Dali talk with.

I have to possible ways of controlling the Dali adress, with binary on-off , where the on value may be put in (0-254) in dali interface
and with 1 byte integrer. Then I can put preset values in the swicth that it will send to the Dali Interface.

Is it possible for you to add the "standard" dimming data type to the Dali interface? 4 bit (3 bit control, and break)

This way it can be possible to seemless dim up and down . Or is there another way to do this?

I am using the Dali to control white LED lamps at the moment and later on i will intergrate RGB and RGBW lamps to it.

Passivpluss


RE: Dali interface dimming - PassivPluss - 01.08.2015

Another feature would be to add how long time the dimming should take. Now when i use the value dim it goes for the percentage instantly. A 1-3 seconds grading should look betterSmile


RE: Dali interface dimming - Peter - 03.08.2015

+1 for including dali dimming through separate object, so we won't need to script this.
thank you


RE: Dali interface dimming - edgars - 04.08.2015

thanks for suggestion!
currently we will add it into our to-do list and will look at it some time in the future Smile
For now, please do this functionality via scripts.


RE: Dali interface dimming - gjniewenhuijse - 14.09.2015

(04.08.2015, 10:10)edgars Wrote: thanks for suggestion!
currently we will add it into our to-do list and will look at it some time in the future Smile
For now, please do this functionality via scripts.

Can you please give an example how to do this?


RE: Dali interface dimming - PassivPluss - 15.09.2015

And automatic feedback status would be great to addSmile


RE: Dali interface dimming - managementboy - 16.09.2015

is there a way of doing this for DMX too? does someone have a good DMX example for a script doing dimming?


RE: Dali interface dimming - admin - 18.09.2015

Right now we don't have enough resources to implement this.

Here's a function for start/stop dimming:
Code:
function bindimmer(up, down, out, event)
 local main, rev, step, val, new, delay

 step = 10 -- in %
 delay = 0.5 -- in seconds

 -- ignore "stop" command
 val = tonumber(event.datahex, 16)
 if val == 0 then
   return
 end

 -- up, normal mode
 if event.dst == up then
   main, rev = up, down
 -- down, reverse step
 elseif event.dst == down then
   main, rev = down, up
   step = -step
 -- invalid object
 else
   return
 end

 -- current output object value
 val = grp.getvalue(out) or 0

 while true do
   -- main object in "stop" state
   if not grp.getvalue(main) then
     return
   end

   -- reverse object in "start" state
   if grp.getvalue(rev) then
     return
   end

   -- get new value
   new = math.min(100, val + step)
   new = math.max(0, new)

   -- no change, stop
   if new == val then
     return
   end

   -- write new value
   val = new
   grp.write(out, new, dt.scale)

   -- wait for next run
   os.sleep(delay)
 end
end

Usage:

1. Add bindimmer function to Common functions

2. Create 3 objects:
1/1/1 - binary (dim up)
1/1/2 - binary (dim down)
1/1/3 - 1-byte scale (output)

3. Create an event script for each binary object:
Code:
bindimmer('1/1/1', '1/1/2', '1/1/3', event)

4. You can tune step and delay variables in bindimmer function to adjust dimming speed


RE: Dali interface dimming - gjniewenhuijse - 18.09.2015

Thanks for the example, but a standard wall switch has two groupaddresses:
- turn on/off (1bit)
- dimming (4 bit, 3bit controlled - 03.007 dim/blinds step)

How to implement this for dali?


RE: Dali interface dimming - gjniewenhuijse - 16.10.2015

(18.09.2015, 13:30)gjniewenhuijse Wrote: Thanks for the example, but a standard wall switch has two groupaddresses:
- turn on/off (1bit)
- dimming (4 bit, 3bit controlled - 03.007 dim/blinds step)

How to implement this for dali?

Is there already a solution for a default knx dimmer button:
up short: on
down short: off
up long: dim + started
down long: dim - started

Its important to control the standard 4 bit, 3bit controlled object for smooth dimming when using dali.


RE: Dali interface dimming - Erwin van der Zwart - 17.10.2015

Hi Gert Jan,

There is no long/short detection by default, the only way to do that is with custom SVG buttons 
that hold JavaScript to detect long/short

But why do it so hard if you can easely use byte value object with a slider?

BR,

Erwin


RE: Dali interface dimming - PassivPluss - 18.10.2015

This is to get dimming from a psycical switch. But if you use one rocker for up and one for down then this will workSmile from the web application the easiest way is from slider.Smile


RE: Dali interface dimming - Erwin van der Zwart - 18.10.2015

Hi PassivPluss,

My remark was on the long/short press from visu.

If you have a physical switch you can use our pushbutton interface MTN670802
There is a long/short press detection parameter with value stepper to send byte value.
You can set stepsize, direction and behavior when reaching min/max. This should work for you. Also all
KNX pushbuttons (plus) have this feature.

BR,

Erwin


RE: Dali interface dimming - admin - 19.10.2015

Have you tried this script?
http://forum.logicmachine.net/showthread.php?tid=13


RE: Dali interface dimming - gjniewenhuijse - 20.10.2015

(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