CoRE - Get peer assistance here with setting up Pistons

Trying to compare a string variable to “is one of” and can’t figure out how to format my compare values. I’ve tried surrounding the values with single quotes, double quotes, and no quotes, and it still won’t work:


Thank you. I’ll try that shortly.

You also might need to add “Cancel on piston state change” under Task Cancellation Policy for the BUT IF to restart the timer on the motion if it becomes active again.

Wont that logic turn on the lights if anyone was already home?

also would it turn on lights as each person came home even if someone was already there?

Question - I have created pistons that (Just something to note) work flawlessly.

Are the variables something i have to type in? or do i select them? Im not much of a coder anymore. Its been 15+ years out of the game…

I can handle simple things, as im a simple man…

Thanks for your help.

Sorry I think I got it. So State Change Only in this case would be referring to the state of the presence sensor?

So if any of the sensors State changes to Present between those times turn on the lights?

I’m still having problems grasping. multiple people arriving at different times with this scenario.

So is after sunset, no one is home. 1st person gets home. presence changes to Present, Lights turn on. - Great.
Person comes is turns off the lights but is still home
Person 2 arrives 30 minutes later. Presence changes to present. Do the lights turn on? It is a state change, right?
That is mainly what I’m trying to avoid.

“State Change Only”, in this case, is referring to the state of the piston, i.e., the state of the condition — presence AND time (between sunset and sunrise).


The state of the piston doesn’t change since someone is already home AND time is between sunset and sunrise. If anyone already home manually turns off the lights, it doesn’t get turned on with the coming and going of the other present sensors.

Ok, last question. I think I got it now. While setting it up I notice there is a setting for is present or changes state to present.

My question is. with the rule you provided. Would the lights turn on after sunset if someone was already home. I think the answer is yes. So would it be better to select changes to present vs is present.

sorry for asking what is probably a simple logic puzzle. haha. I really appreciate the help

EDIT: I guess I keep struggling with what will cause the piston to be triggered. I would think that presence change and time change would trigger the piston. It would then run through the logic to see if the conditions were true.

So sunset hits, the piston kicks off, checks to see if anyone is home. No one home. Go back to paused/not running
Presence sensor changes state. Piston goes off to see if its after sun set, and also to verify that the state of the presence sensor is what it needs to be. If the AND state is met, it does what it is supposed to do.

So in the case of someone being home when it becomes sunset. I would think piston kicks of. “Hey its sunset”, run this rule. Whats the logic. Well after sunset if someone is present, turn on the lights. Well someone is home, so lights ON.

Yes, the lights would turn on.

If you change the “is” (a condition, empty circle) to “changes to” (a trigger, filled circle), with someone already home and it’s sunset, the lights will not turn on since that person’s presence did not change to Present (it was already present). However, when the next person arrives, their presence will CHANGE to Present and the lights will turn on — the state of the piston changes to true. For the next person that arrives, their presence will also CHANGE to Present, however, since the state of the piston is already true, the lights will not turn on even if someone already home manually turns them off.

Hello I was wondering if anybody could help me creating a recipe in which my motion sensor would trigger lights can you turn on for a specific period of time only at night time plus if the light is already on to leave it on leave and at it’s current brightness.

Currently when I try to set this up using a regular routine if my light is already on the routine causes it to change brightness and it time out.

Okay, with this implemented the light comes on with the door opening and it goes off when the door closes. The light also comes on if there’s motion sensed but the light is not turning off when there’s been no motion for the specified amount of time. With the latter I can’t currently test whether constant motion keeps the light on. I do have TCP on but I had also tried it with off.

I will play around but wanted to get this out there in case you have any further ideas.


Thanks, well that brings be back to where I started.

I’m having to change my logic a bit.

I want the lights to turn on after sunset, based on presence.
If anyone is already home, don’t do anything
If someone arrives to the house, then turn on the lights.
As others arrive refer back to the part about not turning on the lights if someone is already home.
But it should not be a one time rule though. Person could arrive then leave and then come back later, would still want lights to turn on.

The problem I keep coming up with is I want to say Don’t do this if someone is present, but then I want to also say do this when they become present. That seems like it cancels itself out. Would either always run, or never run

Post a pic of the piston when you can so we can have a look.

Here you go, thanks.

(Not sure why the bands on mine are coloured different to yours …)

Blue = evaluated to true.
Did you trigger the motion and looked at the piston to see if the timer counted down?

Nope. Will do that now. I’ll report back.

Countdown starts when the motion reports ‘inactive’.

1 Like

Yeah, that threw me for a second. So it seems these Iris Motion Sensors actually go inactive in less than a minute (I always thought it was a minute). I think it was this fact that was making me think it wasn’t working as I was using a separate stopwatch to test.

All is good. Much appreciate your help.

CoRE impresses me more each time I use it. I wasn’t even aware (had not noticed) the timers showing before now.

1 Like

Once you initiate them then sometimes they are selectable. Other times you just have to write them in. If you want the variable to be global then you need to add an “@” in front of it and local variables . Anytime you are passing the variable into a message add “{}” around it.

1 Like

Im not sure where I going wrong in this piston. I want the WeMo switch to turn off after 10 minutes if it has been unchanged from it being turned on.