Page 1 of 1

Need something like loops

Posted: Monday 05 December 2016 16:01
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.

Re: Need something like loops

Posted: Monday 05 December 2016 16:04
by SweetPants
Use LUA for that?

Re: Need something like loops

Posted: Monday 05 December 2016 16:19
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