Coming home lights on and when we leave lights off


#1

1) Give a description of the problem
Welcome Home works but not the Goodbye when we aren’t present

2) What is the expected behavior?
Trying to get a simple Welcome and Goodbye

3) What is happening/not happening?
I get the lights to come on and the message but not when we are not present

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)
(PASTE YOUR LOGS HERE BETWEEN THE MARKS)

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.


#2

My suggestion would be to move that IF block you have embedded within the Else statement and make it separate

if
any presence sensor changes to present
then
set location to Home
blah blah blah
end if

if
any presence sensor changes to not present
then
set location to Away
blah blah blah
end if


#3

Ok I will try that thanks so much.


#4

Mind you, I only barely understand triggers and conditions myself, but it reads to me like your piston is expecting both sensors to leave at the same time. “All of PS1 and PS2 change to not present” means that they both have to change to not present in the same event in order to trigger this clause. That exact event is not likely to ever occur, even if you both walk out of the location at the same time, and it may actually be impossible. Try changing the else if to a condition: All of PS1 and PS2 are not present.

Edit: Adding this thread – Conditions and Triggers: The difference?


#5

Thanks, I’m doing alot of researching in the forms most examples don’t make sense to me yet. So as of now I get the lights to turn on when I’m home. They also come on when my wife arrives. Is there a way that when I’m present it doesn’t run. I’ll be able to test the depart in the morning. I really appreciate everyone helping as I learn on the way.


#6

Going to try this adding any my phone or wife phone not present on the second line.


#7

In practice that should work, but I think line 20 is overkill and might cause problems. I think what could happen if you and wife come home at the same time is that it will trigger on one of you first, but if the second person changes to present before it completes it may cancel the first execution and not complete - the conditions changed and there’s no action to take when all of PS1 and PS2 are present. Granted, I think it’s unlikely that it would actually cause problems IRL and the worst thing that would probably happen is having the wrong color and level on those 2 bulbs. You could also set Task Cancellation Policy (TCP) to never, which I believe forces the piston to fully complete even if the sensors change during execution.

Also, personally I think it’s better to set color and level before the ‘turn on’ to ensure that it doesn’t come on Red 100% (or whatever the last setting was) and then change to White 70%, which looks funny.


#8

OK thanks alot and so far I haven’t had any issues. I will dive into more of setting things up once I understand more.


#9

I accomplished what you’re trying to do by using a separate piston to determine house occupancy, having that populate a Global Variable, and then using the changes to the global variable to drive my lighting piston.

Occupancy Piston (you can ignore the tiles and just use the @Occupancy step for what you’re doing)

Then in your lighting piston, you can say "when @Occupancy changes away from 0, then turn lights on. That way it only triggers when the house has changed from empty and lights don’t randomly turn on if someone is already home.

A simple “when @Occupancy changes to 0” will let you turn the lights off, too.


Global Variable - Varies
#10

Im going to test this out