# \[DEPRECATED THREAD\] webCoRE Beta Milestone 1

**URL:** <https://community.smartthings.com/t/deprecated-thread-webcore-beta-milestone-1/86153>\
**Category:** webCoRE\
**Tags:** core, webcore\
**Created:** [April 30, 2017, 1:02am UTC](https://community.smartthings.com/t/deprecated-thread-webcore-beta-milestone-1/86153 "2017-04-30T01:02:46Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![c1arkbar](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/c1arkbar/32/45652_2.png) [@c1arkbar](https://community.smartthings.com/u/c1arkbar)\
**Post date:** [April 30, 2017, 2:36pm UTC](https://community.smartthings.com/t/deprecated-thread-webcore-beta-milestone-1/86153/25 "2017-04-30T14:36:55Z")

</div>

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

I have created a monster lol

---

<div class="post-metadata">

**Author:** ![Toy4Rick](https://avatars.discourse-cdn.com/v4/letter/t/3ec8ea/32.png) [@Toy4Rick](https://community.smartthings.com/u/Toy4Rick)\
**Post date:** [April 30, 2017, 2:39pm UTC](https://community.smartthings.com/t/deprecated-thread-webcore-beta-milestone-1/86153/26 "2017-04-30T14:39:41Z")

</div>

> [@c1arkbar](#):
>
> How can I make a motion sensor turn on my lights and then off after no activity??

Dustin,

Here is how I do mine, it works just fine, however I am sure others have a cleaner way, until then, enjoy

 ![](https://global.discourse-cdn.com/smartthings/original/3X/4/a/4a9ab28a3c4f734b511823353d2d74f7ac4f5a2a.jpg)

Rick

---

<div class="post-metadata">

**Author:** ![XBOHDPuKC](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/xbohdpukc/32/106346_2.png) [@XBOHDPuKC](https://community.smartthings.com/u/XBOHDPuKC)\
**Post date:** [April 30, 2017, 2:59pm UTC](https://community.smartthings.com/t/deprecated-thread-webcore-beta-milestone-1/86153/27 "2017-04-30T14:59:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![XBOHDPuKC](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/xbohdpukc/32/106346_2.png) [@XBOHDPuKC](https://community.smartthings.com/u/XBOHDPuKC)\
**Post date:** [April 30, 2017, 3:03pm UTC](https://community.smartthings.com/t/deprecated-thread-webcore-beta-milestone-1/86153/28 "2017-04-30T15:03:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ady624](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/ady624/32/32610_2.png) [@ady624](https://community.smartthings.com/u/ady624)\
**Post date:** [April 30, 2017, 3:09pm UTC](https://community.smartthings.com/t/deprecated-thread-webcore-beta-milestone-1/86153/29 "2017-04-30T15:09:41Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![c1arkbar](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/c1arkbar/32/45652_2.png) [@c1arkbar](https://community.smartthings.com/u/c1arkbar)\
**Post date:** [April 30, 2017, 3:11pm UTC](https://community.smartthings.com/t/deprecated-thread-webcore-beta-milestone-1/86153/30 "2017-04-30T15:11:18Z")

</div>

@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 ![](https://global.discourse-cdn.com/smartthings/original/3X/a/2/a2035f7a386397415cdac580d19ae76be4d62505.png) and that will mask your piston and give everyone and import code so it can be quickly added to webCoRE.

---

<div class="post-metadata">

**Author:** ![ady624](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/ady624/32/32610_2.png) [@ady624](https://community.smartthings.com/u/ady624)\
**Post date:** [April 30, 2017, 3:11pm UTC](https://community.smartthings.com/t/deprecated-thread-webcore-beta-milestone-1/86153/31 "2017-04-30T15:11:32Z")

</div>

Oh, forgot to mention there are functions and expressions 😉 you can now do math inside the { } 😉 surprise, surprise!!!

---

<div class="post-metadata">

**Author:** ![XBOHDPuKC](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/xbohdpukc/32/106346_2.png) [@XBOHDPuKC](https://community.smartthings.com/u/XBOHDPuKC)\
**Post date:** [April 30, 2017, 3:12pm UTC](https://community.smartthings.com/t/deprecated-thread-webcore-beta-milestone-1/86153/32 "2017-04-30T15:12:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![c1arkbar](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/c1arkbar/32/45652_2.png) [@c1arkbar](https://community.smartthings.com/u/c1arkbar)\
**Post date:** [April 30, 2017, 3:12pm UTC](https://community.smartthings.com/t/deprecated-thread-webcore-beta-milestone-1/86153/33 "2017-04-30T15:12:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![destructure00](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/destructure00/32/87397_2.png) [@destructure00](https://community.smartthings.com/u/destructure00)\
**Post date:** [April 30, 2017, 3:15pm UTC](https://community.smartthings.com/t/deprecated-thread-webcore-beta-milestone-1/86153/34 "2017-04-30T15:15:11Z")

</div>

> [@c1arkbar](#):
>
> How can I make a motion sensor turn on my lights and then off after no activity??

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

 ![](https://global.discourse-cdn.com/smartthings/original/3X/0/4/04f2e6d7e98df1096e5dbdb93bccbe2f7b793bf4.jpg)

---

<div class="post-metadata">

**Author:** ![XBOHDPuKC](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/xbohdpukc/32/106346_2.png) [@XBOHDPuKC](https://community.smartthings.com/u/XBOHDPuKC)\
**Post date:** [April 30, 2017, 3:16pm UTC](https://community.smartthings.com/t/deprecated-thread-webcore-beta-milestone-1/86153/35 "2017-04-30T15:16:13Z")

</div>

@ady624 fixed expression line is AWESOME!

---

<div class="post-metadata">

**Author:** ![celblazer](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/celblazer/32/24077_2.png) [@celblazer](https://community.smartthings.com/u/celblazer)\
**Post date:** [April 30, 2017, 3:17pm UTC](https://community.smartthings.com/t/deprecated-thread-webcore-beta-milestone-1/86153/36 "2017-04-30T15:17:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![bobbles](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/bobbles/32/76290_2.png) [@bobbles](https://community.smartthings.com/u/bobbles)\
**Post date:** [April 30, 2017, 3:21pm UTC](https://community.smartthings.com/t/deprecated-thread-webcore-beta-milestone-1/86153/37 "2017-04-30T15:21:21Z")

</div>

Copy this and change devices,actions and timers accordingly.

 ![](https://global.discourse-cdn.com/smartthings/original/3X/4/e/4ec30deb4ec21e66382dbb75a9ab95309fe6368e.png)

---

<div class="post-metadata">

**Author:** ![Toy4Rick](https://avatars.discourse-cdn.com/v4/letter/t/3ec8ea/32.png) [@Toy4Rick](https://community.smartthings.com/u/Toy4Rick)\
**Post date:** [April 30, 2017, 3:22pm UTC](https://community.smartthings.com/t/deprecated-thread-webcore-beta-milestone-1/86153/38 "2017-04-30T15:22:11Z")

</div>

> [@c1arkbar](#):
>
> 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.

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

> [@ady624](#):
>
> 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:

Any chance I/we can get a sample Piston or 2 posted in the Sample Piston thread to work from?

> [@XBOHDPuKC](#):
>
> 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 🙂

It does work well for quick trips, haven’t tried staying in the area for longer than 5 mins hehe

Rick

---

<div class="post-metadata">

**Author:** ![c1arkbar](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/c1arkbar/32/45652_2.png) [@c1arkbar](https://community.smartthings.com/u/c1arkbar)\
**Post date:** [April 30, 2017, 3:24pm UTC](https://community.smartthings.com/t/deprecated-thread-webcore-beta-milestone-1/86153/39 "2017-04-30T15:24:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Toy4Rick](https://avatars.discourse-cdn.com/v4/letter/t/3ec8ea/32.png) [@Toy4Rick](https://community.smartthings.com/u/Toy4Rick)\
**Post date:** [April 30, 2017, 3:25pm UTC](https://community.smartthings.com/t/deprecated-thread-webcore-beta-milestone-1/86153/40 "2017-04-30T15:25:54Z")

</div>

> [@c1arkbar](#):
>
> 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

---

<div class="post-metadata">

**Author:** ![XBOHDPuKC](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/xbohdpukc/32/106346_2.png) [@XBOHDPuKC](https://community.smartthings.com/u/XBOHDPuKC)\
**Post date:** [April 30, 2017, 3:26pm UTC](https://community.smartthings.com/t/deprecated-thread-webcore-beta-milestone-1/86153/41 "2017-04-30T15:26:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![c1arkbar](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/c1arkbar/32/45652_2.png) [@c1arkbar](https://community.smartthings.com/u/c1arkbar)\
**Post date:** [April 30, 2017, 3:28pm UTC](https://community.smartthings.com/t/deprecated-thread-webcore-beta-milestone-1/86153/42 "2017-04-30T15:28:18Z")

</div>

> [@Toy4Rick](#):
>
> Any chance I/we can get a sample Piston or 2 posted in the Sample Piston thread to work from?

 ![](https://global.discourse-cdn.com/smartthings/original/3X/b/a/ba5c0b60202a1153be66d5d23cad81d571aa03a8.png)

---

<div class="post-metadata">

**Author:** ![SBDOBRESCU](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/sbdobrescu/32/30067_2.png) [@SBDOBRESCU](https://community.smartthings.com/u/SBDOBRESCU)\
**Post date:** [April 30, 2017, 3:32pm UTC](https://community.smartthings.com/t/deprecated-thread-webcore-beta-milestone-1/86153/43 "2017-04-30T15:32:14Z")

</div>

> [@c1arkbar](#):
>
> have created a monster lol

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…

---

<div class="post-metadata">

**Author:** ![ady624](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/ady624/32/32610_2.png) [@ady624](https://community.smartthings.com/u/ady624)\
**Post date:** [April 30, 2017, 3:36pm UTC](https://community.smartthings.com/t/deprecated-thread-webcore-beta-milestone-1/86153/44 "2017-04-30T15:36:52Z")

</div>

They took you seriously, duh!

[Previous page](https://community.smartthings.com/t/deprecated-thread-webcore-beta-milestone-1/86153.md?page=1)

[Next page](https://community.smartthings.com/t/deprecated-thread-webcore-beta-milestone-1/86153.md?page=3)
