Page 1 of 1

Timer Between 2 Times

Posted: Wednesday 19 October 2016 14:36
by c1381ie
Hello,

ich have a Problem. I Read and test since 4 Hours and can't get it work. i neet the following:

I have an switch that should torned on between 2 Time frames. eg.

Switch = on (when time 12:13 - 12:37 Uhr)
Switch = off (when time 12:38 - 12:12 Uhr)

the following i Have:

Code: Select all

        if ((tonumber(uservariables["Hour"]) >= 14 and tonumber(uservariables["Minute"]) >= 30) and (tonumber(uservariables["Hour"]) <= 14 and tonumber(uservariables["Minute"]) <= 35)) then print("Uhrzeit zwischen 14:30 und 14:35") end
i have an another script that writes the hour an minute to an variable so i can use it in various scripts. but i dont become the time diff to work.

i hope that anybody can help me to get this to work.

Regards
Marcel

Re: Timer Between 2 Times

Posted: Wednesday 19 October 2016 15:56
by Egregius
I use stuff like that all the time in my pass2php script:

Code: Select all

if(time>strtotime('12:13')&&time<strtotime('12:37'){
  if($s['switchname']=='Off')sw($i['switchname'],'On');
}else{
  if($s['switchname']=='On')sw($i['switchname'],'Off');
}

Re: Timer Between 2 Times

Posted: Thursday 24 November 2016 14:33
by borgkitty
instead of using a script you can use the timer function on the switches