Timer Between 2 Times

Moderator: leecollings

Post Reply
c1381ie
Posts: 5
Joined: Friday 07 October 2016 22:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Germany, Stuttgart
Contact:

Timer Between 2 Times

Post 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
User avatar
Egregius
Posts: 2582
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Timer Between 2 Times

Post 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');
}
borgkitty
Posts: 34
Joined: Wednesday 26 October 2016 21:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Contact:

Re: Timer Between 2 Times

Post by borgkitty »

instead of using a script you can use the timer function on the switches
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests