I’ve been struggling with this for months. I’m trying to construct a piston that will set Night mode when “things calm down”, ala the Good Night routine. Except CoRE doesn’t seem to easily create “monitoring” pistons. In short:
– Between 12a and 6a, if motion sensors are inactive for at least 5 minutes, the rear door is closed, and the bedroom light is off, set Night mode.
This never works; the motion sensors never start their timer. Switching any of the conditions to a “changes to” or “stays” won’t work, either; often all those conditions are already TRUE at midnight. Supposedly, when there’s no trigger, all the conditions become triggers, but I haven’t seen that to be the case.
There’s a second logic issue; I want this piston to re-enable Night mode if motion should stop at some point in the middle of the night (I’ve got a second piston that switches to Home mode if motion is detected; that works fine).
Any idea what I’m doing wrong?
(As a further test of my problem, I created a simple piston: if light is off, and time between 8a and 11a, turn light on. I created the piston while the light was off, and enabled it. Both conditions show as TRUE; the light never turns on… I assume because there’s no event to kick this off).
Have you tried making this a ‘basic’ piston.
I see no reason why this should not work.
As an aside if you are just getting started with this you might want to install webCoRE and use that instead.
It’s the next generation of CoRE and you can programme up pistons using a browser so this opens up using your PC.
You can also back up your pistons, copy pistons created by other users recover pistons that have been accidentally deleted etc.
OK, here’s the webCoRE version. Doesn’t work. The logs show the piston restricted up to 9:59 PM, and then again restricted starting at 5:59 AM (that’s correct). But the execution block never gets executed. I can confirm that all the conditions were TRUE at some point.
The logs only show what I mentioned above. Nothing in the logs between 9:59 PM and 5:59 AM. I assume this means that the piston passed the restrictions, but there is nothing to execute because there’s no event.
I expect that this piston will switch to Night mode whenever things calm down, whether that’s at 10 PM or 2:20 AM. Additionally, if mode goes back to Home at some point during the night, the piston will switch back to Night mode once all those conditions are again TRUE.
Piston status right now: “Active and humming happily”.
Quick facts:
Piston state: true (shouldn’t it be false? we’re currently outside the restriction time, and even so, not all the conditions are TRUE at this moment…)
Last executed: 6/1/2017, 7:14:55 AM
Next scheduled: never
Subscriptions: 5 events, no controls
The logic may have a little bit of a dent. The way you set it up is that it expects things to still happen and then “calm down” after 10pm (on Sun through Thu) or after midnight on Fri and Sat. If things are already calm at that time, nothing happens. In essence, you need to have that switch turn off AFTER the cutoff time, or the motion sensor(s) become inactive AFTER the cutoff time, or the contact sensor close AFTER the cutoff time. If things are already calm at 10pm, nothing will happen. That’s because the time is placed in a restriction (they NEVER subscribe to events, as they only restrict other events). If you need the mode to change at 10pm if the conditions are met, then please move the time condition group into the IF, remove it from the only when. Add a group to the IF and add your two time conditions in it, with OR between them, then remove the two conditions and the group from the restrictions section. That will make things happen at 10pm (or 12am on Fri and Sat) or as soon as things “calmed down” after that time, but before 5:55am.
Note the electric bolts on the gutter? They hint you at which conditions subscribe to events - effectively showing what things can cause a piston run - your piston has likely never run.
EDIT: If I were you, I’d add a wait 5 minutes right before the two tasks - you don’t want the door closing to immediately change SHM and location, you will find in time that oh, one day you forgot something and open the door again… alarm blaring Add a wait, or wait until you find out you need to add a wait your choice
6/2/2017, 6:10:41 AM +58ms
+733ms ║Piston waited at a semaphore for 255ms
6/1/2017, 7:38:56 PM +196ms
+989ms ║Piston waited at a semaphore for 505ms
6/1/2017, 6:12:35 PM +669ms
+845ms ║Piston waited at a semaphore for 509ms
6/1/2017, 4:52:50 PM +793ms
+276ms ║Piston execution aborted due to restrictions in effect
6/1/2017, 2:15:46 PM +685ms
+560ms ║Piston waited at a semaphore for 255ms
6/1/2017, 11:06:04 AM +760ms
+1791ms ║Piston execution aborted due to restrictions in effect
6/1/2017, 11:05:50 AM +73ms
+1007ms ║Piston execution aborted due to restrictions in effect
6/1/2017, 10:58:44 AM +598ms
+293ms ║Piston execution aborted due to restrictions in effect
6/1/2017, 10:58:29 AM +186ms
+307ms ║Piston execution aborted due to restrictions in effect
I edited the piston at around 11AM yesterday. That’s when it stopped firing every 3 minutes. At around 4:52 PM I manually switched the mode to Night, and then back to Home, to check something else. The piston checked once at that time. What I’m going to try now is putting the “Location mode = Home” restriction down into the IF block.
Still no dice. I moved the “Location mode = Home” into the IF block, but I didn’t even bother trying it, because there’s still no event to kick things off. So I added two time triggers, one at 10PM (Sun-Thur) and one at 12AM (Fri-Sat). That way, if all conditions are TRUE at the start of the piston, these triggers should run it; if a condition is FALSE, once it becomes TRUE, that should be the trigger. Right?
I noticed that when I added the triggers, all the lightning bolts went away. I also noticed that my understanding of what’s going on has also fled.
Here’s the latest try. It doesn’t work. I manually added all the lightning bolts because I figured that would be a good idea. Why do we want a condition that doesn’t subscribe to an event?
The above piston revision works! Finally. The system correctly arms at 10p/12m if conditions are met, and re-arms during the night once conditions are again met. Thanks everyone for the help.