Jump to content

Help with this code, causing lights to flicker


slm800

Recommended Posts

I have, what I thought was a very simple code as follows to turn my porch light on at a certain time if I was home and at a different time if I was not home, however whenever the light comes on, this code is causing the then, else to stay in a continuous loop making the light go on and off constantly.   

I also tried to remove the else statement as I have a different program to turn the light off if it's not within these time allowances and the light is on, but that didn't seem to work either.

 

Can someone please advise as to what is wrong with my code here and help me understand and advise how to fix it?   Thanks;

 

Turn Light On

If
     (
        $iPhone_New Geofence is 0
     And From 11:00:00PM
         To    7:00:00AM (next day)
     )
Or   (
       $iPhone_New Geofence is 1
     And From 7:45:00PM
         To   1:00:00AM (next day)
     )
And Status 'Porch Light' is not on

Then
     Set 'Porch Light' On
Else
     Set 'Porch Light' Off

Turn Light Off

If
    $iPhone_New Geofence is 1
  And Status 'Porch Light' is On
  And From  1:01:00AM
      To    7:44:00PM (same day)

Then
    Set 'Porch Light' Off
Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...