Jump to content

Simple program problem


drinkwater

Recommended Posts

If

$GarageDoorSensor is 1

And From Sunset + 15 minutes

To Sunrise (next day)

Then

Set 'Garage Exterior Light' On

Wait 1 minute

Set 'Garage Exterior Light' Off

Else

- No Actions - (To add one, press 'Action')

 

The 'Garage Exterior Light' turns on properly when $GarageDoorSensor variable is set to 1 but does not turn off after 1 minute.

 

Any idea why ?

Link to comment

Any time a clause has a Wait or Repeat statement the If can be reevaluated. The UDI Wiki has an excellent explanation of how Repeat and Wait statements can affect execution of statements after the wait or Repeat.

 

One solution is to change the State variable in the Then clause

 

If

$GarageDoorSensor is 1

And From Sunset + 15 minutes

To Sunrise (next day)

Then

Set 'Garage Exterior Light' On

Wait 1 minute

Set 'Garage Exterior Light' Off

$GarageDoorSensor is 0

Else

- No Actions - (To add one, press 'Action')

 

Another solution is to move the Then logic to a second Program that has no If section. The current Program calls the second Program to perform the logic. The first Program cannot be reevaluated because there is no Wait. Even if it is reevaluated to False it does not affect the second Program.

Link to comment

Archived

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


×
×
  • Create New...