Page 1 of 1
Time Delay Light
Posted: Friday 05 February 2021 13:40
by Nefsolive
Hello,
I want to create a script that, at a certain time, turn on a led strip, with a 10 minute delay, ranging from 0% -100%. ex. after 5 minutes be at 50% of the delay! Someone already did something like that?
TY
Re: Time Delay Light
Posted: Friday 05 February 2021 14:42
by waaren
Nefsolive wrote: Friday 05 February 2021 13:40
I want to create a script that, at a certain time, turn on a led strip, with a 10 minute delay, ranging from 0% -100%. ex. after 5 minutes be at 50% of the delay! Someone already did something like that?
Something like
Code: Select all
return
{
on =
{
timer =
{
'at 08:13', -- Change to the time you want the light to be switched on
},
},
logging =
{
level = domoticz.LOG_DEBUG, -- set to domoticz.LOG_ERROR when script is OK
marker = 'dim light',
},
execute = function(dz)
local light = dz.devices('your dimmable light') -- change to name of your light
local dimMinutes = 10 -- amount of time from dim 0 to 100
local step = math.floor(dimMinutes * 60 / 100)
for i = 0, 99 do
light.dimTo(i+1).afterSec(i * step)
end
end
}
Re: Time Delay Light
Posted: Friday 05 February 2021 14:49
by waltervl
For inspiration you could also check a wake-up-light script:
viewtopic.php?p=174803#p174803
Re: Time Delay Light
Posted: Friday 05 February 2021 15:53
by Nefsolive
waaren wrote: Friday 05 February 2021 14:42
Nefsolive wrote: Friday 05 February 2021 13:40
I want to create a script that, at a certain time, turn on a led strip, with a 10 minute delay, ranging from 0% -100%. ex. after 5 minutes be at 50% of the delay! Someone already did something like that?
Something like
Code: Select all
return
{
on =
{
timer =
{
'at 08:13', -- Change to the time you want the light to be switched on
},
},
logging =
{
level = domoticz.LOG_DEBUG, -- set to domoticz.LOG_ERROR when script is OK
marker = 'dim light',
},
execute = function(dz)
local light = dz.devices('your dimmable light') -- change to name of your light
local dimMinutes = 10 -- amount of time from dim 0 to 100
local step = math.floor(dimMinutes * 60 / 100)
for i = 0, 99 do
light.dimTo(i+1).afterSec(i * step)
end
end
}
Hello Waaren,
Thanks again for the help. The script works perfect.
Re: Time Delay Light
Posted: Friday 05 February 2021 15:54
by Nefsolive