Looking for a better motion-controlled light app

Hey everyone,
I’m looking for a SmartApp that is a bit better at controlling my lights with motion detection. If I use the stock “lights follow me” app, my switches will turn on and off properly. However:

If I turn ON a switch manually or with the mobile app, and the motion sensor never registers motion active, the switch will never turn off.

Any ideas? I’m gonna keep digging… if I don’t find anything, I’ll try to write something myself.

Thanks!

If the motion sensor register motion, it doesn’t see you, so it doesn’t seem like the app is the problem. Seems there’s a blind spot with the motion sensor so you can either move the sensor or just add a timed off to the switch itself, like “If it’s turned on, it’ll turn off after X minutes.” It would just be a separate app from the motion sensor one.

I’m currently looking for a motion controlled lighting app that allows you to override the motion controls if you manually press the switch to INTENTIONALLY leave the light on forever, instead of automatically turning off as soon as motion stops. If my wife is cooking in the kitchen and sits down to read at the table while she waits or is stirring something at the stove without generating enough motion to set off the sensor, the lights can turn off on her and that can be dangerous while cooking. So if you come across anything give me a heads up!

2 Likes

Look at this post: Code to not turn lights off that are already on

Unfortunately this doesn’t work for me. I need something to work with Motion Sensors. Once you walk in and the lights turn on, before I can even get to the switch so the original default state is “off”

1 Like

It is a little challenging to determine, when you finally reach the light switch, since the lights have already turned on, pressing the switch means “turn off”.

Would you consider using another switch like an Aeon Minimote or Enerwave 7-Button? Possibly some Virtual Switch devices all working together for this functionality.

Or some code with various timings to give you time to tap the switch, but it would have to be Lutron patent compatible, I think, so as to immediately report the tap and turn the light back on…

Problem is that SmartThings scheduling of short term events isn’t very accurate at the moment.

I see what you’re saying now. The problem is that “Turn off when there is no motion” only works when there has been motion. So yes, if you turn on a light by some means other than motion, it will not turn off with that logic, whether that logic is in “lights follow me” or any other motion based smart app.

So you will have decide what OTHER logic you want to be involved in turning off those lights besides motion. The most obvious choice is time, i.e. “turn off after a period of time”. Note that you can have multiple apps controlling the same lights. So you can keep the motion control that works, and add the time turn-off. Now, this is where it can get tricky: Suppose you turn the light on with the mobile app, and your time thing says turn it off in 5 minutes. Suppose during those five minutes you trip the motion sensor, and are actually in that space actively. The light will still turn off in 5 minutes, even if there is still motion. If that’s not what you want to have happen, you would have to write a smart app to combine the two forms of logic for turning off the light (i.e., turn off after 5 minutes or there is no motion, whichever is later).

Make sense? Easy app to write, or easy to modify one of the template apps.

There is one other method of doing this that I use, and that’s a “master off” concept. I have some lights that are turned on by motion and then off when there is no motion for x minutes. In that same area are some other lights not turned on by motion, just turned on with the switch (a z-wave switch). I have it set up so that when the main set of motion controlled lights turn off, by whatever mechanism, the other lights get turned off at the same time — sort of an “off with me” logic.

Of course, all of this depends on the layout of your lighting, switches, motions, flow in the home, etc. etc.

I want the main kitchen lights to turn on with motion and turn off with no motion after 2 minutes. BUT I want to be able to leave them Always On by pressing the switch, bypassing the motion commands.

If we’re cooking, standing by the stove or sitting at the table reading, it could be still enough for the lights to turn off and with the delays of SmartThings operation it might be a minute or so before the lights are back on which is annoying and unsafe.

1 Like

You will eventually be able to do this once microlocation devices exist and ST uses them. Like iBeacons or Samsung’s Placedge, these won’t require movement to be detected, solving all the use cases you mention above, plus a personal concern for me, the person who falls or passes out and takes several minutes before they start moving again.

Microlocation will probably initially require a wearable for presence to be detected, although ultimately it may do things like listen for heartbeats.

My guess is we’ll have practical in home microlocation based on wearables or at least cellphones by summer 2016. (Apple’s HomeKit clearly assumes they’re coming.) and since this helps make the case for smart watches, I think Samsung may be on a similar timeline.

In the meantime…I personally like motion detectors to turn things on, but I don’t use them in residential installations to turn lights off unless a) the sensor is being used as a touchless switch intentionally triggered with a hand wave, b) they’re used to control a group, but at least one light is not automatically turned off.

My personal feeling from an engineering standpoint is just that motion sensors are usually the wrong technology to use for ongoing occupancy indicators. It’s always going to be hard to get the pattern just right.

But I do think the solution with a different technology is coming. Just not for a year or so.

FWIW…

1 Like

It sounds like your motion coverage is inadequate to the task, if you are in there and the lights are turning off. A couple of things you could do: (1) add another motion sensor to get better coverage, (2) increase the time before it turns off from no motion so that there is a higher probability it sees motion before it turns off, (3) use code like the app I originally referenced above with a Minimote remote control (in this case, pressing a button on the Minimote could disable all of the motion-off logic).

Your case 3) above will still run into the “tricky” issue from your previous post, won’t it?

I can’t kill the previously triggered off instruction once the sensor detected the initial the motion, can I?

So:
Person walks into kitchen, tripping motion sensor, running app that turns lights on and schedules lights off after 5 minutes of no motion.

Person sits at kitchen table and starts reading.

Person hits button on minimote to leave lights on.

After 5 minutes of no motion have gone by, won’t lights still go off?

It depends on how you do the disabling. I clearly didn’t understand his use case / problem at first. Another, possibly superior way to do it is to use a mode. Pushing the Minimote button could cause a mode change to “Cooking”. If the “turn off on no motion” is mode restricted to other modes, just not Cooking, then the light won’t turn off. Forget the “turn off after a period of time” bit. These are kludges. As you pointed out, the source of the problem is relying on motion to turn things off.

I do that (no motion turns things off) in a dozen spaces in my house, and for the most part it works perfectly. Funny one is my office, where I have a motion sensor about 3 feet from where I sit pointed right at me. You are absolutely correct that if I sit here absorbed in something, reading, writing, anything without much motion, the lights sometimes turn off on me. Of course, sitting on my desk is a Minimote. It’s used to turn on a ceiling fan, or to turn the lights back on. This happens very infrequently, and it would happen a lot less if I increased the time from 2 minutes to something higher. These aren’t perfect solutions!

1 Like

Honestly, the use of a mode is completely out of the question. Modes, IMHO, are a disaster. It’s a lot of people’s “go to” workaround instead of having legitimate solutions for where SmartThings comes up woefully short, the problem is that every mode based SmartApp needs to be entirely rethought when a new mode is introduced. If I start creating modes for cooking or other such entirely specific things, it will just compound the problem. Switching from one mode to another doesn’t always work seamlessly and especially not when you aren’t in the correct mode to start with. For example, if I go out with my wife and we come home after the house is scheduled to move from AWAY to NIGHT, it switches to HOME so I have to manually take out the APP and switch it to NIGHT.

My whole purpose of automating is to remove switches and buttons and apps. I want the house to behave the way I need it to behave when I need to behave that way without constant interaction. I want to walk into the kitchen and get a snack and come back to my computer without touching any switches. I also want to leave the lights on when I’m quietly reading without them going off on me.

As for the motion area, it detects just fine, but not if we’re still or walking in and out of the room while doing other things. Or if we’re entertaining we’d prefer to leave the light on so as not to disorient guests. This is just one of many, many areas where SmartThings has exceptionally let me down. I’ve spent over $2k in automation and half of the simple tasks I’ve thought should be common sense, have been impossible to do without a degree in software engineering or in some cases, just plain impossible.

I think microlocation is a bit pie in the sky. WAY too many variables involved to make it work well and be affordable. Not to mention the inconvenience of things not working properly because you don’t have your iWatch or Samsung Gear on to walk from one room to the other. Not to mention guests. I’ll wait and see, but I’m thinking it’s 3-5 years off from being really viable as an affordable consumer DIY product.

I agree (This is because SmartThings only has one mode variable… Only 1 mode active at a time, instead of a way to have a mode for home/away, night/day, and regular/vacation, etc…).

The workaround for having only one global mode variable, is to use Virtual Switches (or Virtual Devices of some other sensible type).

A Device Instance allows you to communicate arbitrarily between SmartApps (ie, if one SmartApp is for motion on and off, and another SmartApp is watching for lightswitch events, the first can check a Virtual Device set by the other, and vice versa).

You can make it less (or more) convoluted, possibly by using Virtual Devices that are an abstraction layer specific to the Physical Devices. In other words, create a Virtual Motion Sensor and have SmartApps subscribe to it instead of the Physical one.

The Virtual Motion Sensor’s status is set by a management SmartApp that watches the Physical one and takes other information into account (ie, has a switch been toggled recently then ignore lack of motion…). Lots of power.

1 Like

It’s a shame that you have discarded one of the most powerful mechanisms in ST because you think it’s a “disaster”. The problems you describe with modes are all easily solved.

Not every automation challenge is easily solved. Expecting something as simple as a motion sensor to work in two completely different ways all on its own is, how to be tactful, not the most thoughtful reaction.

What @tgauchat describes above is a variation of the original link I gave you. There are solutions to what you want if you choose to find them. Good luck.

I think virtual switches would be a great solution for many ST use cases if there were a way in the official ST mobile app to create one without touching the IDE. Just a straight binary on/off switch. There would be so much non coders could do with this. :blush:

1 Like

There is a community app recently published by @baldeagle072 that spawns virtual switches, i.e. on/off virtual devices. Once that app is installed, one would not need to use the IDE to create new virtual switches. See this thread: Feature Request - On/Off Button Tile - why can't you install it from the ST App itself

2 Likes

I’m really excited about this!

Unfortunately, adding a million different modes simply doesn’t solve the problem as it compounds the problem by altering the behavior of every other mode based app. Secondly, I can only run each app once for a single device. I can’t change the parameters of the app for each mode, yet another problem of modes.

As for my expectations, expecting a motion sensor to turn on and off a light is one of the most basic automation uses there is. Expecting the hardwired switch to be able to override that, yes, is my, and as far as I can tell many people’s, expectation. I’m not asking the motion sensor to behave in multiple ways, just that the hardware should trump the software. The switch is another input, just like the app. Yet once I program it to turn off with no motion there is NO WAY short of a mode change (which creates a myriad of other complications I don’t want to go through every time I add a single feature to my home) to prevent it from turning off. Not in the app (short of deleting the SmartApp) or physically. I am not a software engineer so I can’t really code a terrifically complicated piece of software. But using your code (which I DO plan on using for my contact sensor on the door) and needing a remote control to activate a virtual device for the kitchen lights and having to press the remote before I even enter the room is silly and a band aid on an axe wound. When caring for two newborns I am not going to be fumbling around trying to find a remote the size of a pack of gum so I can go in the kitchen without any hassle. These types of awkward, unintuitive behaviors might be acceptable for some, but they aren’t for me as my home needs to be easily occupied by my in-laws who are not technically minded and will expect it to operate the same as their own home. In my mind, automation should ADD features, not remove them.