Logic Machine Forum
Delay for DALI ! - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Delay for DALI ! (/showthread.php?tid=2665)

Pages: 1 2


Delay for DALI ! - phongvucba - 01.06.2020

Hi everyone! I have dim DALI problem on LM. Do you have a solution to help me? It is turned off quickly or turned on quickly, annoying customers
I want dim from 0% to 100% or from 100% to 0% to have a period. For example it will take 5s to complete the event,. In the settings section there is no time.
Thank so much!


RE: Delay for DALI ! - admin - 01.06.2020

You can change fade time of ballasts via a script. Fade time setting 6 is approximately 4 seconds, the larger the value the longer the fade time.
Run this once (assuming you are using internal gateway):
Code:
require('user.dali')

dalicmd('internal', 'setdtr', { addrtype = 'broadcast', value = 6 })
dalicmd('internal', 'storefadetime', { addrtype = 'broadcast' })

I also suggest looking into our CANx-DALI gateway which provides a lot more features than the internal or old RS-485 gateways.


RE: Delay for DALI ! - phongvucba - 02.06.2020

Thank so much , everyone ! Admin !
I have seen it work well! But I do not understand where it will store this information? Smile. But there is something I do not understand, when I do this, my on / off address 11/1/1 it also works dim, I do not want that, I only need 11/1/3 dimmer address. Can it change you? Smile
And I also want to Get the entire state of the light, and bring it up to update. I have tried but it's failed? Help me please. Sad
--------------------------------
require('user.dali')
res, err = dalicmd('internal', 'querystatus', { addrtype = 'broadcast' })
if res then
log(res:byte())
else
log(err)
end
---------------------------


RE: Delay for DALI ! - admin - 02.06.2020

You can try using a script instead of object mapping for binary light control. This event script must be mapped to a binary object. It will control ballast with short address 1.
Code:
require('user.dali')
cmd = event.getvalue() and 'recallmax' or 'off'
res, err = dalicmd('internal', cmd, { addrtype = 'short', address = 1 })

As for status you cannot use broadcast if you have more than 1 ballast. All ballasts will reply to broadcast query which will result in a collision error. Use short address mode for queries:
Code:
res, err = dalicmd('internal', 'querystatus', { addrtype = 'short', address = 0 })



RE: Delay for DALI ! - phongvucba - 02.06.2020

thank Admin !
I do not quite understand! For example, my dimmer is 11/1/3, I want to receive status at 11/1/103. How do I add the code? I really thank you, I'm new. Sad


RE: Delay for DALI ! - admin - 02.06.2020

Use a resident script with 5-10 seconds of sleep time.
Code:
require('user.dali')

res, err = dalicmd('internal', 'querystatus', { addrtype = 'short', address = 0 })
if res then
  grp.checkupdate('11/1/103', res:byte())
end

res, err = dalicmd('internal', 'querystatus', { addrtype = 'short', address = 1 })
if res then
  grp.checkupdate('11/1/104', res:byte())
end



RE: Delay for DALI ! - phongvucba - 02.06.2020

I love you every one ! Smile
Thank so much !


RE: Delay for DALI ! - phongvucba - 03.06.2020

I try! but...Sad
Everyone let me ask! Why is my value not returning as current value? 11/1/3 other than 11/1/103 (status). 11/1/4 other than 11/1/104 (status). 30% and 51%, but it's 4% and 4%. Please help me!
-------------
require('user.dali')

res, err = dalicmd('internal', 'querystatus', { addrtype = 'short', address = 0 })
if res then
  grp.checkupdate('11/1/103', res:byte())
end

res, err = dalicmd('internal', 'querystatus', { addrtype = 'short', address = 1 })
if res then
  grp.checkupdate('11/1/104', res:byte())
end


RE: Delay for DALI ! - admin - 03.06.2020

You need to use queryactual instead of querystatus command.
Try this script:
Code:
require('user.dali')

function queryactual(short, addr)
  local res, err = dalicmd('internal', 'queryactual', { addrtype = 'short', address = short })
  if res then
    local val = res:byte()
    if val > 0 then
      val = math.floor(val / 2.54 + 0.5)
      val = math.max(1, val)
    end
    grp.checkupdate(addr, val)
  end
end

queryactual(0, '11/1/103')
queryactual(1, '11/1/104')



RE: Delay for DALI ! - phongvucba - 14.11.2020

Hi every one !
I am using version 20200720, but the Delay dim or get the status functions are not working? Is it faulty ?, my old version runs ok!
------Delay dim----
require('user.dali')
dalicmd('internal', 'setdtr', { addrtype = 'broadcast' ,value = 7 })--Lưu giá trị 7 vào thanh ghi DTR
dalicmd('internal', 'storefadetime', { addrtype = 'broadcast' })--Lấy giá trị 7 đó ở thanh ghi để cho vào thời gian dimmer
----------update status for addr------
require('user.dali')
function queryactual(short, addr)
  local res, err = dalicmd('internal', 'queryactual', { addrtype = 'short', address = short })
  if res then
    local val = res:byte()
    if val > 0 then
      val = math.floor(val / 2.54 + 0.5)
      val = math.max(1, val)
    end
    grp.checkupdate(addr, val)
  end
end
queryactual(0, '2/7/101')
------------------------------
Please help me!


RE: Delay for DALI ! - admin - 14.11.2020

Try deleting user.dali library from Scripting - User libraries. Reboot after deleting and new version of the same library will appear.


RE: Delay for DALI ! - phongvucba - 14.11.2020

Thanks Admin! It works again. But there's one more thing I have a problem with.
When I scan the ballasts Dim Dali I can't scan all, sometimes it only accepts 2, sometimes it accepts 5  Sad . I do not understand why?
Thank so much everyone! <3


RE: Delay for DALI ! - Daniel - 16.11.2020

This sound like power/cabling issue on DALI


RE: Delay for DALI ! - davidchispas - 24.11.2020

Hi, I had configured this resident script (0 sec) that worked until the LM 20200720 update. Should I change something?
Code:
require('user.dali')

for address = 0, 64 do
  res = dalicmd('internal', 'queryactual', { addrtype = 'short', address = address })

  if res then
    value = res:byte()
    value = math.floor(value / 2.54 + 0.5)


   
   
   
    grp.checkupdate('40/0/' .. address, value)
  end

  os.sleep(1)
end



RE: Delay for DALI ! - admin - 24.11.2020

Have you tried this?

(14.11.2020, 08:05)admin Wrote: Try deleting user.dali library from Scripting - User libraries. Reboot after deleting and new version of the same library will appear.



RE: Delay for DALI ! - admin - 24.11.2020

Don't delete the package, delete the user library:
   


RE: Delay for DALI ! - davidchispas - 24.11.2020

(24.11.2020, 10:58)admin Wrote: Don't delete the package, delete the user library:
Thanks Admin! it's working again.


RE: Delay for DALI ! - phongvucba - 01.12.2020

(16.11.2020, 08:40)Daniel. Wrote: This sound like power/cabling issue on DALI
Thank Daniel ! 
do you mean the source DALI bus is not enough?
I gave it DLP-04R (level gain 0.24A = 240mA) per channel of LM5.
Could it be one more reason?


RE: Delay for DALI ! - Daniel - 01.12.2020

By DALI standard, you should not have more than 2V drop on the dali bus, You should check it next to LM and on the last ballast.


RE: Delay for DALI ! - davidchispas - 04.01.2021

(03.06.2020, 06:11)admin Wrote: You need to use queryactual instead of querystatus command.
Try this script:
Code:
require('user.dali')

function queryactual(short, addr)
  local res, err = dalicmd('internal', 'queryactual', { addrtype = 'short', address = short })
  if res then
    local val = res:byte()
    if val > 0 then
      val = math.floor(val / 2.54 + 0.5)
      val = math.max(1, val)
    end
    grp.checkupdate(addr, val)
  end
end

queryactual(0, '11/1/103')
queryactual(1, '11/1/104')

I need your opinion on how it is advisable to obtain the status of the ballasts in group.

For example, a group of 60 ballasts linked to the same control object. To visualize the real state I need to obtain at least the state of one of them, but in the event that in the future that ballast fails, could I assign the same address to the 60 ballasts?

To visualize the On / Off status, I added another line to the script, is that fine, or is it recommended to do it in another way?

Code:
require('user.dali')

function queryactual(short, addr)
  local res, err = dalicmd('internal', 'queryactual', { addrtype = 'short', address = short })
  if res then
    local val = res:byte()
    if val > 0 then
      val = math.floor(val / 2.54 + 0.5)
      val = math.max(1, val)
    end
    grp.checkupdate(addr, val)
  end
end

queryactual(0, '1/1/0') --Porcentage
queryactual(0, '1/2/0') --1Bit
queryactual(1, '1/1/0') --Porcentage
queryactual(1, '1/2/0') --1Bit
queryactual(2, '1/1/0') --Porcentage
queryactual(2, '1/2/0') --1Bit