Lights on with Motion, won't turn back on


#1

Hey all,

I have used this Piston for months now and thought it was working correctly. Yesterday I entered the room and the light came on, only a few mins later of not moving it went off so I started waving my arms, moving… and it wouldn’t come back on. I had to go open the door for light

Use case:
Upon motion turn on light, wait for motion to be inactive for 10 mins, turn of light

What am I missing?

Rick


#2

Make your first statement changes to active instead of is active


#3

Well same results. So that didn’t work

Any other ideas

Rick


#4

Add a Wait 10 mins to your first Then block.

Move the Turn off to after the new Wait.

Get rid of your Else and second If.

Keep the first If to ‘is active.’

Change the first/remaining With TCP to Never (click With and click the cog for this option).


#5

OK, so i’ll give this a go

Rick


#6

As you only have a condition (no triggers) you actually do not need to force the subscription on the If. Your setting is doing no harm however.


#7

Well, this is still not working

Help… anyone

Rick


#8

You haven’t said what is not working exactly. However, I suspect I know.

You have not set the cancellation policy as I mentioned above (I see after looking again you had it on the previous example but not this one) …

I think you can remove the Set Piston State too. I’m not sure what that’s achieving.


#9

Well, I have tried it several different ways and so far, nothing

What happens is the light goes on with motion, 10 mins later the light goes off even though I have been walking around the whole time. Also, it won’t turn back on until the motion sensor resets after a few mins

I made the changes, again and will try it again later today

Rick


#10

Have you tried this with two IF statements. The first IF motion changes to active turn on. The second is IF motion changes to inactive wait x time turn off.


#11

Got it. Well, I have many instances of this exact thing coded. The TCP set to Never cancel should stop the light going off if motion stays active. What you are describing is what happens with the default TCP setting of cancel.

The only thing I have different in my pistons is I’m not setting the piston state to true.

I think you are going to get an SMS each time the timer is reset though once we get the light to stay on as desired. That is because each time motion is set to active again the with block will be rerun.


#12

Honestly though, this should not be needed.


#13

Many ways to accomplish the same goal


#14

I don’t disagree.


#15

Here’s part of one of my pistons that does what you are trying to do (with an additional condition of temperature). In this case it’s a Fan Control Switch but that is irrelevant.

Note, I am forcing the condition to subscribe but only because this is part of a larger piston that also has triggers. Otherwise the force to subscribe would not be needed.

You can ignore the Set Piston State stuff.