Jump to content

Newbe Sensor Question


sessayan

Recommended Posts

Posted

So I want a simple program to turn on the kitchen light when the sensor is activated, wait a certain amount of time like 2 minutes (I set to 25 seconds for testing) and then turn the light off. I put together below and the light does not turn off. The scene Kitchen Sensor contains 'Kitchen-Cans' . Of course I am new to the environment and trying to figure things out. Wife going nuts as the lights cycle off and on as I learn. "You’re wasting more electricity than saving" hehe

 

If

Status 'KitchenSensor' is On

And Status 'KitchenSensorDusk.Dawn' is On

And Status 'Kitchen-Cans' is not On

 

Then

Set Scene 'Kitchen Sensor On' On

Wait 25 seconds

Set Scene 'Kitchen Sensor On' Off

 

Else

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

Posted

The " Set Scene 'Kitchen Sensor On' On" is changing something the If is checking. When the Wait is encountered the If is reevaluated to False driving the Else clause. Common solution is to separate If from Then in two Programs. If section in first drives the Then clause which invokes the second Program. The second Program has nothing in the If and the Then logic from the current Program. When the Wait is encountered there is nothing in the second Program If to reevaluate so the statement after the Wait executes.

 

Suggest looking at the UDI Wiki. There is a good explanation of the effects of Wait and Repeat statements.

Posted

Besides kitchen cans, What other devices are in the scene "kitchen sensor on", and what is your purpose in creating this scene? What is your intentions with your third condition (kitchen cans not on)? In my mind, this condition has no purpose given your stated requirements.

Posted

Nothing else in the scene at this time.

 

The Status 'Kitchen-Cans' is not On is there because the sensor was picking up traffic when someone walked out the back door and we had manually switched the lights on so the sensor was turning them off.

 

I was trying to avoid having the sensor do anything if the lights were allready on.

Posted

So as LeeG suggested, i broke out the process into two seperate programs and it works the way its suppose to. Thank you sir!

 

I include the examples below for anyone other newbies that might need the same help.

 

Kitchen Sensor

 

If

Status 'KitchenSensor' is On

And Status 'KitchenSensorDusk.Dawn' is On

And Status 'Kitchen-Cans' is not On

 

Then

Run Program 'Kitchen Sensor Timeout' (Then Path)

 

Else

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

 

 

Kitchen Sensor Timeout

 

 

If

- No Conditions - (To add one, press 'Schedule' or 'Condition')

 

Then

Set 'Kitchen-Cans' On

Wait 30 seconds

Set 'Kitchen-Cans' Off

 

Else

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

Guest
This topic is now closed to further replies.

×
×
  • Create New...