Time Delay Light

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
Nefsolive
Posts: 69
Joined: Monday 04 September 2017 17:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Time Delay Light

Post 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
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Time Delay Light

Post 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
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
waltervl
Posts: 6691
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Time Delay Light

Post by waltervl »

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
Nefsolive
Posts: 69
Joined: Monday 04 September 2017 17:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Time Delay Light

Post 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.
Nefsolive
Posts: 69
Joined: Monday 04 September 2017 17:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Time Delay Light

Post by Nefsolive »

waltervl wrote: Friday 05 February 2021 14:49 For inspiration you could also check a wake-up-light script: viewtopic.php?p=174803#p174803
Thank´s waltervl
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest