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
Time Delay Light
Moderator: leecollings
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Time Delay Light
Something likeNefsolive 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?
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
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
- waltervl
- Posts: 6691
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2025.1
- Location: NL
- Contact:
Re: Time Delay Light
For inspiration you could also check a wake-up-light script: viewtopic.php?p=174803#p174803
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
Nefsolive
- Posts: 69
- Joined: Monday 04 September 2017 17:13
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Time Delay Light
Hello Waaren,waaren wrote: Friday 05 February 2021 14:42Something likeNefsolive 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?
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 }
Thanks again for the help. The script works perfect.
-
Nefsolive
- Posts: 69
- Joined: Monday 04 September 2017 17:13
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Time Delay Light
Thank´s waltervlwaltervl wrote: Friday 05 February 2021 14:49 For inspiration you could also check a wake-up-light script: viewtopic.php?p=174803#p174803
Who is online
Users browsing this forum: No registered users and 1 guest