How can I make a motion sensor turn on my lights and then off after no activity??
I have created a monster lol
How can I make a motion sensor turn on my lights and then off after no activity??
I have created a monster lol
Dustin,
Here is how I do mine, it works just fine, however I am sure others have a cleaner way, until then, enjoy
Rick
Thanks @ady624.
What about this one? I know that I can do if here:
if Any of Sensor kitchenâs or Sensor Living Roomâs motion is active then
@Set variable {@LivingAreaMotion} = true;
Would be so nice to avoid if statement and get this working like:
@Set variable {@LivingAreaMotion} = Any of Sensor Kitchenâs or Sensor Living Roomâs motion IS ACTIVE;
I canât see how to add that bold part, all I get is
@Set variable {@LivingAreaMotion} = Any of Sensor Kitchenâs or Sensor Living Roomâs motion; and Iâm not sure what the result of that assignment will be.
The problem with this is that motion sensor 1 can become active again within those 5 minutes and youâll turn off the light on someone in the room
One way to avoid that is to set a global variable every time your sensor goes inactive for now() + 5 minutes and reset it every time sensor goes active. Then another event will trigger when now() > this variable. This way you keep pushing this time back every time a sensor goes active / inactive and only any lack of sensor activity will trigger your automatic light off routine.
Or alternatively, your line 36 should check if the motion sensor is still inactive before turning the light off. But it literally becomes too complicated to track this one piston - my understanding that multiple instances of it should be able to run in parallel to account for the wait. And what happens if motion becomes active while this piston is already waiting? Will another instance of this piston fire off? I mean this multitasking is just too complicated for an average user to think of, thus itâs much better and cleaner to split it into separate pistons - one takes care of motion and setting/clearing that separate 5 minute variable and another triggers when the variable expires.
Declare a device typed variable called motionSensors and set it to the list of devices.
Declare a boolean typed called motion variable and set it to this expression:
count( [motionSensors:motion] )
Then set @LivingAreaMotion = {motion}
Or if you donât want the motion variable, you can set it directly:
Set variable @LivingAreaMotion = {count( [motionSensors:motion] )}
Or, if you donât want the motionSensors variable either, use this:
Set variable @LivingAreaMotion = {count( [Motion Senso 1:motion], [Motion Senso 2:motion], [Motion Senso 3:motion] )}
List all the devices you want, format is [deviceName:attribute] and it returns the value of that attribute for that device. count() is a function that returns the number of elements that are true (and in motion-speak active is true, inactive is false)
@Toy4Rick Thank you for the reply but I was making a joke from a previous thread about when this goes beta. Also it will be helpful to do like I mentioned above when sharing pistons. Click the green photo button and that will mask your piston and give everyone and import code so it can be quickly added to webCoRE.
Oh, forgot to mention there are functions and expressions you can now do math inside the { } surprise, surprise!!!
yeah i saw the functions, is there an easy way to get a list of those, or âjust read the codeâ?
You can do this with Smart Lighting. I use it about 5 rooms and works well. Plus runs local on the V2 hub so works when the net or ST is down.
Yes I am aware, havenât had much luck in the past with capturing the piston once in the anonymizer in Win10 so a screen grab, edit in Paint was easier. Seems to be working now
Any chance I/we can get a sample Piston or 2 posted in the Sample Piston thread to work from?
It does work well for quick trips, havenât tried staying in the area for longer than 5 mins hehe
Rick
What I do is when the image is up just right click on it and copy. Then just paste it straight into the reply box. Bam uploaded, no need to save and upload from computer.
Yep that works
Rick
Itâs not even that you stay in that area for 5 minutes⊠Imagine you walked in, walked out. After some time motion stopped and your 5 minute counter started and you walk in a couple secs before the timer expires.
No, you fed the monster, @ady624 created the Godzilla of all Rule Engines. Adi, you did it again. Thank you for your hard work! And good luck to a smooth progression to the Release Candidate. You rock my friend⊠your effort is really appreciatedâŠ
They took you seriously, duh!