Mode is 'Away' and After Dark: Notify Me


#1

Understanding Conditions:

I wrote a piston for the first time that isn’t using “triggers” and it appears webCORE auto subscribes to the conditions if I don’t have a trigger in the piston. In the case of my piston, there are multiple subscriptions. I guess I’m trying to understand how subscriptions that tie themselves to conditions work exactly? How do I discern how to properly subscribe to the right conditions if webCORE is not correct? In this case, maybe I don’t need to be subscribed to all 3? Unsure…

Trying to Accomplish in my Piston:

I basically want there to be a way that:

  1. When it’s between sunset - sunrise THEN
  2. IF my hub’s mode changes to away at any time
  3. And my wife and I are not in specific locations
  4. At any point when all of these conditions are true (within the boundaries of #1), send me a text. I’m currently testing, but later on I want it to run a smartapp to turn my lights randomly on/off while I’m away

Comments:

There may be a better way to write this, and I’m open to that…I just want to ensure this will work based on how I want it to work…but I’m unsure because I’m still new to webCoRE and I’m still not totally confident I understand conditions - mainly when webCoRE subscribes to multiple ones.

Thanks in advance for any insight…

Snapshot Attached:


#2

I don’t have presence sensors that have a currentPlace attribute, but I think your conditions should be more like:

Presence Sensor 1's currentPlace is not any of "Work,School"

But I could be wrong. Haven’t seen anything like {“Work” || “School”} yet in webCoRE (but I’m also pretty new to it.)

Basically, I think what you have is correct, except I would set the Task Execution Policy (TEP) on the Send SMS statement to “Condition change only”. E.g., if one of the presence sensors changed from something that is not Work or School to something else that is also not Work or School, you’d get multiple text messages. But maybe that’s what you want.

But to answer your basic question, yes, when there are no triggers anywhere in the Piston, then all conditions effectively become triggers. (More accurately, they are all subscribed to.) I.e., whenever one of them change the Piston will run and the conditions will be evaluated.

Also, note, that for the Time condition you have, there will be two events associated with it: 1) when time becomes 20 minutes past sunset (in which case that condition becomes true), and 2) at sunrise (at which time that condition will become false.)


#3

Personally I would write it that way then…

You can make #1 a restriction. You only want the Piston to run between those two times. I doubt you also want it to run based on those times happening…which is what it will do as is. So make that a restriction.
For #2, make that a trigger. Location mode changing can absolutely be a trigger. Then make the other two things the conditions. That way you only have one Trigger, mode changes to away…and all should work fine.


#4

Thanks Mike…do I need to subscribe to the conditions as well? I just want to make sure this runs …because this needs to run when all conditions are met…and could occur at any time during that period.


#5

Nope. The conditions can be left as conditions. They will be evaluated each time the piston fires to determine whether or not to do the rest of the steps, but you don’t need to subscribe to them to make that happen.

So the basic setup would be like:

Only when
Restriction is true
IF Trigger happens
and condition is true
and condition is true
Then

Personally I like making pistons that have that structure. It makes them very easy to read, and with only one Trigger you know exactly what action is going to make things happen. So they become a little bit easier to troubleshoot. What you’re doing is simple enough though that you could take many approaches at it…but I still prefer to maintain the same structure anyway.


#6

Gotcha thanks, will give that shot. Thanks for responding as well @pnbruckner .