Motion Based Light EXCEPT when Manually turned On

manual
except
off
light
motion

#141

There is a SmartApp called group of groups that helps with that 1 light turns on then the next et. It seems to work pretty well, at least better.


#142

Ill give it a look tomorrow. Thank you!


#143

The post gives very little information about how to install it or set it up without combing through the entire post(s) for this DTH. Once set up, probably improperly, it doesn’t control anything, group or otherwise. Either that or I am just too tired to notice what I have done wrong. Thanks, but I think I will pass on this LGoG as I wouldn’t know how to implement it into the wC piston i am using anyway. Waiting a few seconds for the lights to react suddenly seems fine now… shrugs Thanks again :slight_smile:


#144

what do you use PC or Mac?


#145

I use PC


#146

actually check this webpage. run the ping test then check your ST IDE corresponding AWS region to see if the ping times look higher than other regions:

http://www.cloudping.info

heres my results … i am in california west so 19 ms for me:


#147

Its fine here afaik. Im down in Florida so I would imagine I am using Virginia or Ohio.

I was able to figure out a minimal usage of LGoG and it does work very, very well. No lag at all between lights going on or off any more. I would say it solved the issue 100%, however the lag times for Smartthings control when using a virtual switch is odd. There should be a way for them to correct this behavior as other services seem to be able to deal with this issue to the point that it is simply a non-issue.

I have attached the piston as it sits now and does work as intended. Let me know if anything looks out of sorts to you. Thanks for all your help man!

Edit: It should be noted that the LGoG DTH is where ‘RBG Bulb 11’ currently is for this green snapshot and that is what allowed me to eliminate the lag I was experiencing. It replaced the 4 bulbs that were there before.


#148

I’ve noticed one issue with the piston (after editing capture and restore conditions to prevent overwrite).

If the bulb is turned OFF during the wait period, the {SaveLight} attributes that are stored don’t clear.
I’ve tried adding–
x2 Set variable {SaveLight} = (empty)
to the last RGB Bulb 11 statement, but it doesn’t seem to do what I expected.
How do you clear attributes from a store without restoring?
TIA


#149

Amazing thread here. Lots of good information and troubleshooting. I was hoping that someone would be able to give me a hand figuring out how to create a specific piston. Right now, I’m using a common piston used to turn on lights if motion is detected and then turn off those lights after a specific amount of time if no motion is detected.

Here’s what I’m using:

What I ultimately want to do is have my lights shut off after no motion for a certain amount of time, regardless of how they were turned on. Right now, I’m changing a variable named programmatically to “true” if the lights turn on via motion. And later in the piston I’m turning off the lights only if the variable is true.

Is it possible for me to simply remove the variable from the code and have this piston run without the variable? For example, the first IF statement will only be looking for motion and turn the lights on if motion is detected and the second IF statement will only be looking for motion to change to inactive to turn the lights off. This would be regardless of the way they were actually turned on.

FYI, I’m not using smart bulbs. I’m using two GE smart dimmer switches to turn on the lights. Thanks in advance for your help!


#150

Yes you can remove all the variable stuff and it will work as you want


#151

Perfect thanks! I’ll edit the code later and see how it runs.


#152

I’ve been using the original version of this code and it works a treat, thanks. However, I’ve now tried to modify it to work in the opposite way so when I turn off a light in my Daughters bedroom it then ignores the motion. I sort of have this working but I know I’m using the If, Then, Else incorrectly as I have three times slots also for different lighting levels. So although it initially works for each If statement, it goes back and runs the first Else and hence the timer.

Appreciate that this is more basic WebCoRE logic that I’m getting wrong here as opposed to this EXCEPT logic.

Here’s my code, a point in the right direction would be appreciate and sorry for the poor coding.


#153

Ok, so went back to basics as I didn’t have the logic right for the variable to keep the light off anyway. It was a bit more difficult to reverse the logic so if a light is manually turned off, it won’t come back on via motion but this is what I have come up with.

I didn’t see any other examples in the thread so I thought I would post in case a) it’s useful to anyone or b) there is a better way to achieve the same thing.


#154

General question regarding a piston I am working on (Sorry I don’t have anything to post yet).

I am still new to WebCoRE and was wondering if there would be a way to write a piston to trigger an event if a motion sensor sensed motion X amount of times (change from inactive to active).

Example: If you have a room where something else is already on (indicating the room is occupied) and the motion sensor senses motion X number of times, could a piston trigger the lights to stay on and turn off the motion sensing?

I think it could be done with a variable which counts the number of times motion is active but I am not familiar with how to write that in WC.


#155

Taken the basics I posted above I have now expanded this out to take in the time slots I was after previously and I can report this now works fine. The key is with turning the light off before the motion sensor goes inactive. If this is done then motion will not re-activate the light. This allows me a degree of flexibility around my Daughters bedtime knowing that when I turn her light off it won’t came back on if she moves :slight_smile:

I now have this controller her room and the original from this post controlling the light outside her room so it stays on and acts as a nightlight.


#156

hi i have just been wading through this thread, looks good
can i use a smartthings button as the switch ?


#157

Yep, though it appears webcore is limited to single push, and long hold for using buttons as a trigger.


#158

I had a go at doing this myself before finding this thread. What’s the reason my original code wouldn’t turn the light off?


#159

If this is the case is it because you have an Only When the light is off.
This means your second IF will never be true.
Just remove the Only when light is on.

Just my guess that is whats happening.

EDIT: You have your ONLY WHEN at the top which is an umbrella for the whole piston.
If you want to use only when light is off, you have to set it against the top IF only.


#160

Thanks for your help.

If I put the only when switch is off against the first if.
Say someone turns the bulb on another way and then it senses motion would it activate the second if in this code once the motion stops, turning the light off?