Need something like loops

Moderator: leecollings

Post Reply
icompas
Posts: 1
Joined: Monday 05 December 2016 15:53
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Need something like loops

Post by icompas »

Smarthome automation is interesting, but what I always find are scenes or some kind of one time event.
What I need is the following,

Mo - Fr: between 05:00 and 23:00, switch on a pump repeatedly on for 5 minutes, off 5 minutes
Sa - Su: between 06:00 and 24:00, switch on a pump repeatedly on for 5 minutes, off 5 minutes

I haven't found anything useful yet. Anyone any idea? Very much appreciated.
SweetPants

Re: Need something like loops

Post by SweetPants »

Use LUA for that?
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Need something like loops

Post by emme »

you can setup switches that act your pump and then use timers

otherwise.... you can use a LUA script (Time Event )

Code: Select all


dow = tonumber(os.date('%w')) 
-- Day Of Week goes from 0 (Sun) to 6 (Sat)
t1 = os.date('*t')
swPump = 'place here your pump device name'

commandArray = {}
    if dow == 0 or dow == 6 then
        if t1.hour >= 6 then
            if (t1.min % 5) == 0 then
                commandArray[swPump] = 'Toggle'
            end
        end
    elseif (t1.hour >= 5) and (t1.hour <= 23) then
        if (t1.min % 5) == 0 then
                commandArray[swPump] = 'Toggle'
            end
    end
return commandArray
The most dangerous phrase in any language is:
"We always done this way"
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests