Page 1 of 1

help with dimming 100 > 10 and back via "Hold" switch

Posted: Wednesday 29 April 2020 23:29
by bradsystem
hello members :)

im newbie with dzVents,..

on/off light with "click" is ok
with "hold" reducing light to 10% is also ok
with this script:

Code: Select all

return {

   on = { devices = { 62 }},        -- Name of your button
               
   execute = function(dz, item )
        if item.state == "Click" then
            dz.devices(55).toggleSwitch()      -- Name of your light
        elseif item.state == "Hold" then
            dz.devices(55).dimTo(10)    -- Name  of your light
        end
   end
}
but i want with next "hold" to recover light output to 100%
or "click" always toggle light to 100% from off
(one of these methodes)

thxx brad
sry for my english

Re: help with dimming 100 > 10 and back via "Hold" switch

Posted: Thursday 30 April 2020 0:31
by waaren
bradsystem wrote: Wednesday 29 April 2020 23:29 on/off light with "click" is ok. With "hold" reducing light to 10% is also ok

but i want with next "hold" to recover light output to 100%
or "click" always toggle light to 100% from off
Not sure if this is what you want but can you give it a try?

Code: Select all

return 
{
    on = 
    { 
        devices = 
        { 
            62,        -- 'Name' or idx of your button
        },
    }, 
               
   execute = function(dz, item )
        local light = dz.devices(55)
        if item.state == "Click" and light.state == 'Off' then
            light.dimTo(100)
        elseif item.state == 'Click' then 
            light.dimTo(1)
            light.dimTo(0).afterSec(0.3)
        elseif item.state == "Hold" and light.state == 'Off' or light.level < 50  then
            light.dimTo(100)
        elseif item.state == "Hold" and light.level > 50  then
            light.dimTo(10)
        end
   end
}

Re: help with dimming 100 > 10 and back via "Hold" switch  [Solved]

Posted: Thursday 30 April 2020 0:47
by bradsystem
hello waaren,

WOW.. works by both ways.. "hold" high>low>high.... and click also restore light to high from low>off..

thx alot !!