[DEPRECATED THREAD] webCoRE Beta Milestone 1

How can I make a motion sensor turn on my lights and then off after no activity??

I have created a monster lol

6 Likes

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 :slight_smile:

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)

2 Likes

@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 :wink: you can now do math inside the { } :wink: surprise, surprise!!!

1 Like

yeah i saw the functions, is there an easy way to get a list of those, or “just read the code”? :slight_smile:

I already read the code and produced this on the wiki https://wiki.webcore.co/Functions

2 Likes

Not possible with SmartThings. What do you think this is? Get a dog.

1 Like

@ady624 fixed expression line is AWESOME!

1 Like

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.

Copy this and change devices,actions and timers accordingly.

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 :slight_smile:

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.

1 Like

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…

4 Likes

They took you seriously, duh!

3 Likes