WebCore Piston Help for Motion Sensor and Lights

I have a motion sensor and a light switch. I would like to auto turn OFF the switch when motion stops for xx minutes if the switch is ON.

The kids always leave these lights on and I would like to alleviate having them on when no one is in the kitchen for 10 minutes.

What type of switch is it?
Is it a Smart switch.
There are numerous ways of doing this.
Have you looked at Smart Lighting?

1 Like

It is a lutron caseta dimmer control for my kitchen high hats over a counter.

Use Smart Lighting.
In the mobile app go to the Marketplace tab.
Then SmartApps.
Now select Smart Lighting.
You just go through the menus.

1 Like

But I want to use WebCore! lol.

I don’t blame you.
In that case import this.


The red N is to never cancel tasks.
This way if there is motion in the 10 minute window the timer will reset.

2 Likes

thank you!!!

Wait ā€œNever Cancel Taskā€? Wouldn’t that keep the timer going regardless of whether motion restarts or not? As soon as motion is inactive, the wait starts and doesn’t stop, regardless of the conditions, or am I getting something backwards?

I was wondering if someone was going to query that.
It doesn’t sound right does it.
If you go into the settings for Task Cancellation Policy in the dropdown there are various options.
What it means is if there is a piston state or condition state change the task will cancel.
If you select ā€˜never’ then the task will always complete UNLESS the piston becomes true again. In that case the Timer stops. When it becomes false again, the Timer restarts. I hope that makes sense.

Ok, I see what you’re saying… Just one thing I’m confused on. You said when it becomes true again, the timer stops, and when it becomes false, the timer restarts… Ok, so just so I’m following the first part… the true again thing makes sense enough, but the timer is supposed to start if the piston is true, so why would it have to become false again to restart the timer? (Trying to understand, not be snarky)

Also, using your logic, if I walked out of the room while fixing dinner, motion goes inactive, and the timer starts. If I walk back in and keep cooking for longer than 10 minutes, the piston never becomes true again, so the lights would still go out, wouldn’t they?

Again, still trying to wrap my head around all this. Thanks!

Spot on. I got my trues and falses back to front. :blush: (No offence taken by the way).
So here goes again.

If you select ā€˜never’ then the task will always complete UNLESS the piston becomes false again. (i.e. there is motion or the light is manually turned off). In that case the Timer stops.
When it becomes true again, the Timer restarts. (i.e. switch is on and motion sensor is inactive).

Really sorry about that.

So is the code for the piston good? Seems to work, but I am not home to test the motion part.

Yes. I’m pretty sure the code will work OK.

Did this work OK for you?
I’m worried there may be an issue with how I’ve written it.
I’m not saying though in case it is OK!!! :wink:

I am still testing. Will let you know more tomorrow.

How does this light ever turn on? Another piston?

It looks like this is for situations in which the light is turned on manually, otherwise you could use motion to turn on the light within the same piston.

I have multiple motion sensors tied to multiple smart bulbs. How would I incorporate the above with not turning on during motion during daylight hours? Say between 0800 hours to 2030 hours?

I’m having some issues when attempting to get WebCore to recognize triggering the motion sensor to turn on a switch when specifying only a time or a day of week or month. It seems to respond as expected when I specify the ā€˜Day and Time’ option from the drop down but not any other combination. Even when I tried the to ā€˜Select All’ for Day of Week, Month , etc it did not perform.

I’m trying to follow the webcore introduction video - https://www.youtube.com/watch?v=jgXA_rv2-_8
but I noticed that since 2017 there is no ā€œAdd a new Restrictionā€ menu option as seen at mark 6:36 of the video when I go to add new task.

Was the ā€œRestrictionā€ option removed from webcore. I’ve looked around and haven’t seen any mention of it. As a matter of fact …there is no ā€¦ā€œonly whenā€ available so it might require a different set up similar to the screenshot. As I mentioned, specifying a exact date and time works when used the way I created the if statements. I’m stumped on why specifying a more general ā€œTimeā€ for any day of the week isn’t working.

Change motion is active to motion changes to active. Also, if you want the light to turn off After thirty seconds, you can add that to the first section and get rid of that else block…

Turn light on
Send sms message
Wait 30 seconds
Turn light off

Also, a good place to check out and ask questions is the webcore forum. Lots of webcore users over there who love to help others write their pistons. Plus there are lots of example pistons you can look at.