Is there a way to turn off switch when there is motion ? Or is there already an app for this?

There is a standard way to do this, but it’s not in the lights group. The lights groups only let you turn ON when there is motion, not let you turn OFF when there is motion.

I’m quadriparetic, and I use motion sensors as touchless switches, so I’m very aware of what’s built into the official mobile app. (I can code, but I don’t want to: processing groovy with a text to voice reader is a real pain.)

Anyway, the standard option to turn something off after a motion sensor trigger is in hello home actions. But there is a trick to it. You have to also change the mode when you first set up the hello home action, or it will not offer you the motion sensor trigger possibility. See the following topic:

So easy to use, no custom code required, but not easy to find where to set it up.

I need it to turn OFF with motion not on . And then after set time turn on when no motion .
I can not find anything anywhere to do this .

See my post just above yours. You can do the turn off with motion with a hello home action, the trick is you have to also include a mode change the first time you set up the hello home action or the set up wizard will not offer you the motion sensor options.

Then you can have a second hello home action to turn the light on again after inactivity.

Here are the screenshots.

Add a new hello home action. You can see I am turning on some lights, and turning off others.

After you select the actions you want to have happen, tap done at the top right of the screen.

On the next screen, change the mode. Then tap the “automatically perform” option.

On the next screen, you will see your options for triggers for this hello home action.

If and only if you selected a mode on the previous screen, you will have two new choices that involve motion sensors: “when things start happening” and “when things quiet down.”

“When things start happening” let you select a motion sensor whose activity will trigger all your choices from the first screen.

“When things quiet down” let you select a motion sensor whose inactivity after a period of time that you will specify will trigger all your choices from the first screen.

Remember to tap done at the top of each screen as you go through to save your changes.

So you will set up one hello home activity that will turn something off because of activity on a motion sensor. And you will set up a second hello home activity that will turn something on after a period of inactivity on the same motion sensor.

Hope that helps!

Ahhh, hmmm, yea, don’t think there’s a built in one for that.

There isn’t a built-in one in the lights group, but there is definitely a built-in one in the hello home actions set up, I use it all the time for Touchless switches. :blush:

Thanks for the help . I am trying to get it to work now .
Really appreciate the help .

I am new to this , but this Smartthings base app really needs a multi tool on , off , time , day , settings app . I do not need a controller that asks me questions I just need a controller that does what I tell it to do .
I used X-10 years ago and it had a more clear interface to perform actions than smartthings does . Maybe not as complicated actions as smartthings can do , but for me it was a lot easier .

1 Like

Many people agree with you, me included!

Here’s what’s currently officially available:

And there are some rules engines that have been built by community members for others to use. Not officially supported, but quite popular. See the following topic:

There is a built-in one in Lights & Switches, called “Turn off when there is no motion”. You don’t need a Hello Home phrase to do it.

My bad, that app turns off with no motion, not on. Here is a very simple app that uses a virtual switch to reverse the sense of “Turn on when there is motion”, or any other shortcut for that matter. You can create a virtual switch in the IDE, and then put it in the “Turn on when there is motion” shortcut, instead of the real switch.

 *  Flip motion on
    name: "Flip motion on",
    namespace: "",
    author: "",
    description: 'Reverse sense of shortcut with virtual switch (On/Off Button Tile)',
    category: "My Apps",
    iconUrl: "",
    iconX2Url: "",
    iconX3Url: "")

preferences {
	section("Specify the real switch(es)..") {
		input "realSwitches", "capability.switch", title: "which one(s)?", multiple: true, required: true
    section("Specify the virtual switch...") {
    	input "virtual", "capability.switch", title: "Virtual switch:", multiple: false, required: true

def installed() {

def updated() {

def initialize() {
	subscribe(virtual, "switch", switchHandler)

def switchHandler(evt) {
	if(evt.value == "on") else realSwitches.on()

We are finalizing the testing for this. Stay tuned :slight_smile:

Or you can use the smartrules app.

1 Like

Yep, that’s one of the two community-member-created rules engines I mentioned in the post above. And why they’re popular. But not officially supported.

Yeah it’s a great solution for guys like me that know nothing about technology but desperately want to use it.

1 Like

Thanks drake0508 , I looked at Smartrules app , but I need it for the Samsung S5 and it looks like it only works on Iphone.

Thanks Bruce for the code . I am at a loss how to use it . Sorry , but bought Smarthings thinking I would not need to code to use it .
How would I use your code .
I also looked at Smartrules , but it looks to only work for Apple products .

Generally speaking, you don’t have to know how to code to use ST. When I started, I new nothing about ST, Groovy, the ST environment etc. But, I was a computer science student from way back, so I just started hacking other people’s code.

Anyway, to install a custom app, including this one, you can follow these simple steps.

  1. Login to the IDE at
  2. Click on My SmartApps, then click on New SmartApp
  3. Select the From Code tab
  4. Copy and paste the code from above into that window, and click Create.
  5. Click Publish, and For Me

At that point the app will be on your mobile device.

For this app to work, you need to first create a virtual switch. Follow these steps:

  1. In the IDE, click on My Devices, then New Device
  2. Fill in the form, giving it a name, and an address (just make up a 4 digit number, like 2001)
  3. Select for Type, On/Off Button Tile (this is a virtual switch)
  4. Click on Create.

Now you will have your virtual switch available.

To install the app, hit the + on your dashboard, then slide all the way to the right to My Apps. In there you will find, “Flip motion on”. When you click on that you can select the preferences for the app, which will be your real switch and the virtual switch.

What this app does is reverse the sense of another app that would “Turn on when there is motion”. In that other app (likely from Lights & Switches), you select the virtual switch instead of your real switch. So once you’ve done that, it becomes in effect, “Turn off when there is motion”. You can select a time interval, where after x minutes the original app will “turn off” because motion has stopped. Since we’ve reversed on and off, that will cause the real light to turn on after x minutes instead.

Happy to help. You can send a Private Message if you need more help.

Are you an all android household? No iPad lying around?

No, I’m an all Apple household. Ha Ha.

Maybe they should have mentioned that in some kind of warning before I bought this smarthings toy.

I don’t think Android vs. Apple has much to do with it, frankly. There are quirks with the Android mobile app. But the guts of ST doesn’t depend on either, nor is there any advantage to either that I know of.

1 Like