Motion Based Light EXCEPT when Manually turned On



WOW! That app has a LOT of features! I agree that it would probably do what I’m looking for. Unfortunately, when I create a room, set the name, then hit SAVE, it gives me an error, and doesn’t save the room :frowning:


The ST log definitely shows the “turn on” event coming from the Google Home, so it should be possible to distiguish.

If you don’t mind building me the logic framework, I will put in my devices, and see if we can get it to work!


whats the error shown in the IDE log?

did you publish both the rooms manager and rooms child smartapp and the rooms occupancy device from the IDE?


DUH… no. I hadn’t installed the device. I got it all working, but it doesn’t do what I want in terms of changing the light based on the lux sensor, so it’s back to the pistons :slight_smile:


sure it does. just create 2 rules for those lux values. :slight_smile:

or use AL settings to automatically change the level / color temperature with time of day.


The trick I use for this portion of your dilemma is using a Simulated Switch.
(make sure you choose a unique name)

Piston 1:
If SimSwitch turns on
Then turn on favorite lights
End IF

If SimSwitch turns off
then turn off favorite lights
End IF

Piston 2: (the one you are working on)
If Motion changes to active
then turn on favorite lights
End IF

If Motion remains inactive for 10 minutes
SimSwitch is OFF
then turn off favorite lights
End IF

The hardest part may be training your household to use the new SimSwitch for Google instead of asking it to turn on the specific lights like they are used to doing…


nah not really that hard. Just name your simulated switch to the name of your lights the way your used to, and rename the original lights to something else


That would work very well…

And if it is a group of lights that Google Home toggles, then you can delete that group, and name the Simulated Switch the same name


did the posts from @WCmore and @Gopack2 solve what you were looking for?

if not please dont hesitate to ask any of us here.


Those are good ideas. I’ve asked for some help with the logic from some friends, but they haven’t had a chance to help out yet.

I’ll post what we come up with, if it does the trick.


try this. i slightly modified the first piston in this thread for what you mentioned in your post. i have set the level to 35% when lux is above 800 otherwise to 70%. if you want to set the level to something else when the lux is below 400 thats an easy change to the set level statement.


Hello everyone,
I’m new to smart things and completely new to WEBcore (and of course I still haven’t figured out how to start…)
I’m sorry because my issue it’s probably something very easy, but I have to admit…I’m lost!
What I want is to have a simple motion sensor activated light controlled by movement, but I also want to capability to disable motion sensor pressing a Flic button I have in my bedroom.
Can somebody point me to the right direction? I don’t know ho w to program, perhaps a piston already made would save me a lot of troubles…
Many thanks


try this:


I like this @bangali, is that an exclamation point on line 47?
I have never seen this before…
Does that toggle the boolean variable each time it is pressed?


thanks, it is.
just cooked it up for OP.


You are DA MAN! I have two more questions:

  1. I assume it only works with booleans, correct?
  2. Does it also work on globals?


works on any data type … always returns a boolean


Thanks to all the posters above; I’ve taken the examples for inspiration and adjusted for my use case:

I wanted the physical switch to pretty much continue to operate as a ‘dumb’ switch; but also add some motion controlled smarts for general use. I’m using the Aeotec Nano Dimmer (as I’m in the UK and the switches don’t work with my wiring).

The physical switch operates as an override to the motion detection, so if you switch it off, motion detection is ignored for the next hour. Operating the physical switch while it is in override mode just drops it back to motion detection controlled. This way if ‘someone’ forgets to turn the light off in override mode it will still eventually turn itself off…

I had a hard time understanding the logic in the first example post, as I didn’t realise that the ‘programmatic’ variable was actually a workaround to the piston not being able to differentiate ‘physical’ and ‘programmatic’. All in all good practice and a learning experience. Very open to any suggestions on how to optimise my code :slight_smile:


I love this idea but would like some help with my situation. What I would like is for my motion to turn on my bulbs for 5 minutes and then turn off if no activity. If the light is manually (ST) turned on, then remain on until manually turned off. I have a “Sleep Switch” that I use that basically disables the motion during sleeping time (so the light doesn’t come on when we go to the bathroom and wake the other person up). In a strange way (timer set for 8 hours) I have the sleep switch turn off - thus the motion is reactivated. I also have a different piston that is supposed to turn on these same lights when my alarm goes off.
How can I incorporate all that into 1 (or 2) pistons? I can’t get my mind to think in combining so I have a ton of pistons running and I think they are getting as confused as I am.


may be try rooms manager? :slight_smile: