Piston with no event

(Scott) #1

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).


(Bob) #2

Can i suggest you post a screenshot of your piston so the peeps on here can look and advise you on what could be wrong.

(Scott) #3

(Bob) #4

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.

(Scott) #5

I’m aware of webCoRE; I’ve been procrastinating making the switch, especially since it’s still in alpha.

I’ll try switching it to a Basic piston, though I’ve previously had it as one, and it didn’t work then, either. I’ll post again if I have success.



Out of alpha :slight_smile:

(Scott) #7

I stand corrected!

(Scott) #8

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.

( I hate Mondays) #9

@FoulFoot What actions did you perform, what were you expecting to happen, and what happened? Any logs?

(Scott) #10

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.


(Scott) #11

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

( I hate Mondays) #12

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 :smiley: Add a wait, or wait until you find out you need to add a wait :smiley: your choice :slight_smile:

(Scott) #13

Nope, still didn’t fire last night. :frowning: Here’s the updated piston:

And the relevant log entries:

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.


(Scott) #14

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?

( I hate Mondays) #15

You’re shooting darts in the dark. Why don’t you:

  1. enable full logging (see the level below the logs in the piston view) and post those please, after you try to run it
  2. enable trace (once you run it once, a trace button will show up, click it

Thank you

(Scott) #16

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.