Other time-off in daylight saving time period

Moderator: leecollings

Post Reply
maceddy
Posts: 13
Joined: Saturday 13 January 2018 21:07
Target OS: Raspberry Pi / ODroid
Domoticz version: 12723
Location: Hoogeveen
Contact:

Other time-off in daylight saving time period

Post by maceddy »

I don't really know where to post but since all my 'scripts' are blockly based I start here.

My garden lighting goes on at sunset and switches off at 23:45. However, I would like to have it turned off one hour earlier in the winter (no DST).
I was looking to make a 'DST' switch with on/off but I can not really find a way of doing that.

Maybe I am better off with Lua or dZvents but I have zero experience in that. Who can help me on the way with this?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Other time-off in daylight saving time period

Post by waaren »

maceddy wrote: Thursday 03 December 2020 23:25 Maybe I am better off with Lua or dZvents but I have zero experience in that. Who can help me on the way with this?
In dzVents you can set a switch named dstSwitch using below script.

__________________________________________________________________________________________________________________________
When not yet familiar with dzVents please start with reading Get started Before implementing (~ 5 minutes). Special attention please for "In Domoticz go to Setup > Settings > Other and in the section EventSystem make sure the checkbox 'dzVents enabled' is checked. Also make sure that in the Security section in the settings you allow 127.0.0.1 to not need a password. dzVents uses that port to send certain commands to Domoticz. Finally make sure you have set your current location in Setup > Settings > System > Location, otherwise there is no way to determine nighttime/daytime state."
___________________________________________________________________________________________________________________________


Code: Select all

return
{
    on =
    {
        timer =
        {
            'at 00:03',
        },
    },

    execute = function(dz)
        local t = os.date('*t')
        if t.isdst then
            dz.devices('dstSwitch').switchOn().checkFirst()
        else
            dz.devices('dstSwitch').switchOff().checkFirst()
        end
    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest