Manually override piston if switch touched?

Hi all,

I’m wrestling with figuring out how to bypass this piston if the switch is changed. This basically turns the bathroom lights on at 80% during the day, and only 1% between midnight and 7am. The 1% sounds odd, but it’s not - it’s a do-able level with our current bulb+dimmer combination.

Problem to solve: Sometimes we stay up past midnight (obviously) and would like to manually override the piston somehow by setting the dimmer higher than 1%. There also needs to be a way to temporarily override the piston entirely when the switch is activated, to avoid false positives while the motion sensor resets.

My first thoughts are to create an additional piston to accomplish this somehow, but I’m hoping to get the community’s feedback first. I haven’t started to play with pistons-within-pistons yet.


Rather than time restrictions, can you set mode restrictions?

If Mode is not Night
Master Bath Motion is active…

But if Mode is Night
and Motion is active…

1 Like

Excellent thanks! This actually occurred to me while falling asleep last night, but it’s good to wake up and have confirmation. :slight_smile:

I added an extra condition for if the switch is off - that should prevent it trying to automatically change the dim level if someone has set it to their preference.

1 Like

Assuming that you could use the physical dimmer to raise lights greater than 1% (and thereby trigger the exception), use a latching piston for this:


| –
| | MBath Motion is active
| |
| | AND
| |
| | Time is between 7 & Midnight
| | – if this condition true:
| | immediately set variable bathLevel to 80
| | immediately set variable offTime to 20
| | immediately set variable lateNight to false
| | – if this condition false:
| | immediately set variable bathLevel to 1
| | immediately set variable offTime to 5
| | immediately set variable lateNight to false

– if this group true then:
– immediately set variable bathLevel to (your desired late night level)
– immediately set variable offTime to (your desired late night inactivity period)


| Using Master Bath…
| – Set level to variable bathLevel


| MBath Motion is inactive

Master Bathroom switch is on

THEN (Local task cancel on condition state change):

| Using Master Bath…
| – Wait variable offtime mins

– Turn Off

Alright you’ve opened a whole new world for me. I’m plugging this in and will report back.

Cool. Following a white rabbit down uncharted territory isn’t always easy, but is almost always fun.

1 Like

Okay I’m not sure I need the extra lateNight variable since I’ve tied the two dim levels to Mode. And I think this should allow manually changing the dim level so it stays that way while someone is in the bathroom.

And now I know how to use variables - thanks!

Just thought I’d share my solution to this problem, as we use this all over my house, but especially for bathrooms just like you do.

  1. I have a piston which manages location modes based on presence and time of day to set the location mode to one of five settings: Day (Home), Day (Away), Night (Home), Night (Away), Sleep (Home). These run automatically at set times or can be pre-empted earlier through manual running a routine.,

  2. For my light piston, I use a Latching piston too, but like this

If (Master Bath motion changes to active)
Using Master Bathroom Light…
set level 100% (Only for Day (Home) or Night (Home))
set level 1% (Only for Sleep (Home))

But if (Master Bath motion is inactive)
Using Master Bathroom Light…
Wait 1 minute
Turn off

Written this way, the latching piston keeps the light on as long as I’m in the bathroom, then turns it off a minute after I leave and the motion sensor goes inactive, regardless of whether it’s set to 100% or 1%

If I happen to get up in the middle of night during sleep mode and the bathroom light comes on to only 1%, I can reach for the dimmer switch and raise it to 100% or whatever and because the piston is keying off the change to active motion rather than the state of active motion, Core will not override my manual change unless the motion sensor goes inactive and then changes back to active


wjarrettc - Thanks for this. Very similar to what I have going, aside from the different offtimes.

This has an inherent problem though (which I’ve detailed in the other gigantic thread): If you hit the switch to turn off the light on your way out the door, and then you or someone else immediately enters, it is likely that the motion sensor hasn’t reset yet and is still on “active”. This means now that the room is occupied again so soon, the motion will never “change to” active, and thus will never turn on the light.

Easy solution is to just never hit the switch. Not an option in the middle of the night when the light opens right into my wife’s eyes. :smile:

Yes, that does happen, but not very often in my household. If it does, there is a light switch on the wall as backup. I prefer my lights to go off quickly after I leave rather than the long wait times in your scenarios.

That’s the great thing about CoRE. You can literally make it do just about anything you want, not what someone else prescribed.


I don’t know why my rule is not working properly. If I enter the bathroom, it changes to active and thus set the level to 40%. If I override it with the switch and set the level to 100%, after a few seconds/minutes that it senses movement it resets back to 40%. Any ideas?

I am also wondering if my sensor is not that sensitive and it goes to inactive even though someone is in the bathroom. If that is the case, is there a way to adjust this trigger time in the sensor? This is SmartThings sensor (new version)

Try adding a qualifying condition to the actions in the If.Then statement.

Under Set Level to 40% add an additional restriction to do this only when Master Bedroom is OFF
Under Set Level to 1% add an additional restriction to do this only when Master Bedroom in OFF

See if that works for you.

1 Like

Thanks! That actually did the trick! Thanks for taking the time to help with this.

Here is my new rule.

1 Like

Yeah, I was pretty sure what was happening is that your motion sensor is going inactive, flipping the Latching Logic and starting the 15 minute timer, then it was sensing you again, re-flipping the latch back to the turn on action…That’s still happening but the actions just no longer take place when the switch is already turned on.