Light on from motion sensor and stays on from a different motion sensor


#1

Here’s another piston that I’ve been struggling to figure out. All of the IF statements work as desired (because someone else wrote them) :grinning:, except the first one. In the first IF statement I’m trying to add a condition so that after the lights have been triggered by a motion sensor and on for 5 minutes it should check a second motion sensor for activity, if there is activity leave the light on, if there is no activity or after the activity has stopped wait 1 minute and then turn the light off. Below is one of the iterations that I have tried.


#2

I’m definitely not an expert but i think you need to remove the second if in the first bracket you added (line 34).

See not an expert, @c1arkbar has all the answers below!


#3

It’s helpful to leave the formatting up and answer those questions.

You are only asking about lines 21-44?

When motion sensor 2 detects motion and its two hours till sunset and a switch is off. Turn on all those lights and then wait 5 minutes.

After that 5 minute wait you then want to check motion sensor 6 for inactivity and if true wait another minute then turn off?

If yes to above

You need to change the TCP settings for the with @ line 28 and the if @ line 34 to never cancel.

What is happening is your condition state is changing to false inside that 5 minute wait time. This cancels all the remaining tasks.


#4

Thanks guys for the input, with your input and reading some other pistons, I got it working.
I’ll use the template in the future.
Thanks!