Page 1 of 1

Time scheduled feature

Posted: Sunday 10 May 2020 15:10
by jarmoboy
Is anybody missing on timers do something every 10 /second/minutes/hours/week...and etc.?

Re: Time scheduled feature

Posted: Sunday 10 May 2020 15:38
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
      },
    }

Re: Time scheduled feature

Posted: Monday 11 May 2020 14:06
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

Re: Time scheduled feature

Posted: Monday 11 May 2020 14:20
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

Re: Time scheduled feature

Posted: Tuesday 12 May 2020 7:48
by GJKNL
And 'every 360 minutes' ??

Re: Time scheduled feature

Posted: Tuesday 12 May 2020 9:50
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.

Re: Time scheduled feature

Posted: Tuesday 12 May 2020 13:14
by GJKNL
Yes, you'r right!

Re: Time scheduled feature

Posted: Wednesday 13 May 2020 13:14
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.

Re: Time scheduled feature

Posted: Wednesday 13 May 2020 14:54
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.