Time scheduled feature

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.

Moderators: leecollings, remb0

Post Reply
jarmoboy
Posts: 33
Joined: Wednesday 12 February 2020 6:39
Target OS: Linux
Domoticz version: v2022.2
Location: Czech
Contact:

Time scheduled feature

Post by jarmoboy »

Is anybody missing on timers do something every 10 /second/minutes/hours/week...and etc.?
DOCKERED v14824,NODE-RED,Tasmotized Sonoffs,Tasmoadmin,zigbee2mqtt,EWPE,REST980,WLED
hoeby
Posts: 528
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: Time scheduled feature

Post by hoeby »

Doing every 10 seconds something is not wise.
System will be very busy.

but every minuut, hour, day, week is no problem with DZvents

https://www.domoticz.com/wiki/DzVents:_ ... gger_rules

Code: Select all

on = {
        timer = {
            'every minute',             -- causes the script to be called every minute
            'every other minute',       -- minutes: xx:00, xx:02, xx:04, ..., xx:58
            'every <xx> minutes',       -- starting from xx:00 triggers every xx minutes
                                        -- (0 > xx < 60)
            'every hour',               -- 00:00, 01:00, ..., 23:00  (24x per 24hrs)
            'every other hour',         -- 00:00, 02:00, ..., 22:00  (12x per 24hrs)
            'every <xx> hours',         -- starting from 00:00, triggers every xx
                                        -- hours (0 > xx < 24)
            'at 13:45',                 -- specific time
            'at *:45',                  -- every 45th minute in the hour
            'at 15:*',                  -- every minute between 15:00 and 16:00
            'at 12:45-21:15',           -- between 12:45 and 21:15. You cannot use '*'!
            'at 19:30-08:20',           -- between 19:30 and 8:20 then next day
            'at 13:45 on mon,tue',      -- at 13:45 only on Mondays and Tuesdays (english)
            'on mon,tue',               -- on Mondays and Tuesdays
            'every hour on sat',        -- you guessed it correctly
            'at sunset',                -- uses sunset/sunrise info from Domoticz
            'at sunrise',
            'at civiltwilightstart',    -- uses civil twilight start/end info from Domoticz
            'at civiltwilightend',
            'at sunset on sat,sun',
            'xx minutes before civiltwilightstart',     --
            'xx minutes after civiltwilightstart',      -- Please note that these relative times
            'xx minutes before civiltwilightend',       -- cannot cross dates
            'xx minutes after civiltwilightend',        --
            'xx minutes before sunset',
            'xx minutes after sunset',
            'xx minutes before sunrise',
            'xx minutes after sunrise'  -- guess ;-)
            'between aa and bb'         -- aa/bb can be a time stamp like 15:44
                                        -- aa/bb can be sunrise/sunset
                                        -- aa/bb can be 'xx minutes before/after sunrise/sunset'
            'at civildaytime',          -- between civil twilight start and civil twilight end
            'at civilnighttime',        -- between civil twilight end and civil twilight start
            'at nighttime',             -- between sunset and sunrise
            'at daytime',               -- between sunrise and sunset
            'at daytime on mon,tue',    -- between sunrise and sunset only on Mondays and Tuesdays
            'in week 12,44'             -- in week 12 or 44
            'in week 20-25,33-47'       -- between week 20 and 25 or week 33 and 47
            'in week -12, 33-'          -- week <= 12 or week >= 33
            'every odd week',
            'every even week',          -- odd or even numbered weeks
            'on 23/11',                 -- on 23rd of november (dd/mm)
            'on 23/11-25/12',           -- between 23/11 and 25/12
            'on 2/3-18/3',11/8,10/10-14/10',
            'on */2,15/*',              -- every day in February or
                                        -- every 15th day of the month
            'on -3/4,4/7-',             -- before 3/4 or after 4/7

            -- or if you want to go really wild and combine them:
                'at nighttime at 21:32-05:44 every 5 minutes on sat, sun',
                'every 10 minutes between 20 minutes before sunset and 30 minutes after sunrise on mon,fri,tue on 20/5-18/8'

            -- or just do it yourself:
                function(domoticz)
                -- you can use domoticz.time to get the current time
                -- note that this function is called every minute!
                -- custom code that either returns true or false
                ...
            end
      },
    }
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
jarmoboy
Posts: 33
Joined: Wednesday 12 February 2020 6:39
Target OS: Linux
Domoticz version: v2022.2
Location: Czech
Contact:

Re: Time scheduled feature

Post by jarmoboy »

Thanks for reply. I know about it. But if i want timer which do something for ex. every 6 hours, so when you enter scripts its automatically reseted and its starting from zero (for example you need to repair or add script which has nothing to do with this script).

PS: not everybody is well oriented in scripts so can be difficult for them to apply something what is not copy/paste style
DOCKERED v14824,NODE-RED,Tasmotized Sonoffs,Tasmoadmin,zigbee2mqtt,EWPE,REST980,WLED
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Time scheduled feature

Post by waaren »

jarmoboy wrote: Monday 11 May 2020 14:06 If i want timer which do something for ex. every 6 hours, so when you enter scripts its automatically reseted and its starting from zero (for example you need to repair or add script which has nothing to do with this script).
This is not how dzVents works.
If you use 'every 6 hours' , the script will be triggered at 06:00:00 , 12.00.00, 18:00:00 and 00:00:00
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
GJKNL
Posts: 36
Joined: Monday 31 October 2016 9:33
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Time scheduled feature

Post by GJKNL »

And 'every 360 minutes' ??
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Time scheduled feature

Post by waaren »

GJKNL wrote: Tuesday 12 May 2020 7:48 And 'every 360 minutes' ??
as per the wiki: the number of minutes in the rule must be > 0 and < 60
'every <xx> minutes', -- starting from xx:00 triggers every xx minutes
-- (0 > xx < 60)
every 360 minutes will generate below error

Error: dzVents: Error: (3.0.5) every 360 minutes is not a valid timer definition. Can only run every 1, 2, 3, 4, 5, 6, 10, 12, 15, 20 and 30 minutes.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
GJKNL
Posts: 36
Joined: Monday 31 October 2016 9:33
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Time scheduled feature

Post by GJKNL »

Yes, you'r right!
jarmoboy
Posts: 33
Joined: Wednesday 12 February 2020 6:39
Target OS: Linux
Domoticz version: v2022.2
Location: Czech
Contact:

Re: Time scheduled feature

Post by jarmoboy »

As i said, iam not good at scripts and the script you postetd is surelly not copy/paste. For example if i want every 4 hours from device change state or whatever its not written there and i need to know dz events.
DOCKERED v14824,NODE-RED,Tasmotized Sonoffs,Tasmoadmin,zigbee2mqtt,EWPE,REST980,WLED
User avatar
Egregius
Posts: 2582
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Time scheduled feature

Post by Egregius »

Or you can try pass2php. Pretty easy there to do something x secondes after last switch.
Just something like past('switchname')>3600 will do.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest