Sharing my first piston - kitchen lights automation


I’ve created my first webcore piston, been running and tweaking it for a week using the informative posts around here.

Thought I’d share it if anyone finds it useful, or if there are any improvement suggestions.

I have two kitchen lights for two sections of the room, one Smartthings motion sensor (I will eventually add a second one for more granular control).

I’ve set the lights to turn on under a certain lux level using the Weather Station tile, or with a motion trigger from sunset to sunrise.

I’ve set the lights to turn off after x minutes of inactivity, depending on the time of day. The red N option (I believe) resets the timer if motion is detected. This section will probably be adjusted/improved once I get a second sensor. I find the sensor thinks the room is inactive if you’re standing in one spot, or sitting and eating unfortunately. Any other sensors out there that are more sensitive than the Smartthings model?

Any feedback on the piston is appreciated.

PIR Sensors detect “motion” based on very small changes in heat moving across the detection field. So standing still would generally be perceived as no Motion. It’s not about one sensor of this type being more sensitive than another: you aren’t doing what they are measuring.

This is why kitchens can be particularly tricky if someone is cooking at the stove: the stove itself gives off so much heat that your slight movements, like stirring a pot, are not perceived as a change in that area.

There are various things you can do depending on the details of the situation and how important it is to you.

If normally only one person is home, then you can turn off the kitchen lights based on movement in a different room. That’s the whole “light follows me“ Idea.

If they are typically multiple people home, sometimes it’s easier just to extend the trigger., So the light doesn’t turn off until there’s been no movement perceived for 20 minutes or something. Whatever it takes to not turn the light off while someone’s cooking.

To catch people sitting at the table, you can put a pressure Mat On the chairs and not count it as “no motion” if someone is on the chair.

You can use a different kind of sensor, like an indoor camera, but most people find that creepy. But some people are OK with combining it with an acoustic sensor so that either PIR “motion“ or a certain noise threshold keeps the lights from turning off. Of course the acoustic sensors don’t work if you also play music that you want to have the motion sensor inactivity trigger to go off (because the music itself will keep the lights on).

Then there are other options as well, again it just comes down to the details of each particular household. :sunglasses:



In case you weren’t aware, WebCORE has its own forum where they share pistons and ideas.


I used to do something similar then I split everything up into more modular things, so that it would be easier to troubleshoot, but also so there would be less subscriptions in that one piston, and so that it would be more reliable, rather than have one thing do it all.

My setup has one piston to turn on the lights and another to turn off the lights. Period. Just control, no subscriptions.

Then I have a motion piston that does the whole “if movement then call the light on piston.”

Then I have a timer piston that checks if there hasn’t been any motion in x minutes and calls the light off piston.

The advantage for me is that I can still reuse the code to turn the lights on based on other events like arrivals or starting the day, and I can use the lights off code for away mode or good night or whatever.

I also have a sort of intensity setting based on time of day, so at night I turn on the lights if there’s motion but only up to 10% rather than full blast.


Appreciate all the insights, lots to learn from, and try out!


I think it gets easier once you start mapping things like this, and it does help figure things out down the road.

I got tired after a while of going into some long piston with a bunch of red traces in the conditions and it was impossible to figure out which one of the if statements was the one returning false. :slight_smile:

Although it still worries me that I have so many eggs in the WebCore basket, and I’m not 100% convinced that more pistons is better than less subscriptions. So your mileage may vary. :slight_smile:

One other solution that you might wanna consider is a break-glass automation switch, in case things go south, so you don’t have to go pause a bunch of pistons.

I have a global Boolean called “automation_enabled” which I have as a condition to the more intrusive pistons. So if you have someone staying over and you want to revert the house to “mostly dumb” you can set that Boolean to false and most things won’t happen.