Change Mode to Night and Set SHM to Arm (Stay) when things quiet down


#1

I have a piston that is set up to change the mode from Home to Night after 10pm if all the external doors are closed and motion downstairs has not occured for more than 10 minutes.

The piston fails to run most nights - there is no motion detected on any of the motion sensors, but the piston often fails to execute (and will sometimes execute randomly).

If anyone can see any obvious omissions/errors please do let me know.

As an aside - I had an issue with this not working if I arrived home after midnight, as the time condition (>=10pm) was no longer met, I have a duplicate piston now that has this set up for if the time is <=6am to account for coming home late.

Best wishes
Guy


#2

Take a look at https://community.webcore.co/t/shm-arm-disarm-based-on-presence-and-set-times/4770

There may be some code in there you can use to accomplish what you want.


#3

I think you might be having an issue where if the motion trigger fires before 10pm and then doesn’t get triggered again afterwards then it doesn’t run. This piston is only triggered when the final motion sensor becomes inactive for 10 minutes.

Wait until after 10pm trigger a motion detector and then wait 10 minutes and it should work. Also, try logging the piston to see what happens at each stage.

As an aside, why have two pistons when you could change the time condition to an or group and say before 6am or after 10pm?


#4

Thanks both for your replies, I have now got the Piston working by re-arranging the order as suggested by StevenJonSmith - thanks!

At some point I will merge both the Pre-midnight and Post-midnight Pistons, I think because I was having trouble with it running I wanted to isolate as many variables, but now I have it working I’ll merge the 2 timeframes using an OR statement.

Thank you again for your help - that’s why I love this community, if there’s a challenge people are always willing to come forward and help!

The working piston is here for reference:


#5

I always put the trigger condition first, someone else on this forum suggested it and since I started doing it it makes sense as it’s a bit easier to read.


#6

Glad to hear this is working.

I was going to suggest wrapping the whole expressions with “If time is between 22:00:00 and whatever time you deem and location mode is not Night.” Then I’d remove the “location mode is Home.”