Don't turn lights on when someone in bed? (Without using pressure mats)

In the UK and use Alexa as my main method of communicating with my smart home. I prefer not to use any apps for anything except initial setup and this works well in practice, so far…
I have Lohas (Tuya) Lights and ST Motion Sensors in all rooms in my home.
I have used virtual switches/sensors where necessary to customise switching them on dusk till dawn, when motion is detected (and turning them off again after a minute of no motion).
All great except when someone is in bed, possibly asleep.
I have been trying to think of ways to stop the main bedroom light switching on if someone is already in bed. I initially thought about pressure mats in the bed to detect presence but soon went off this idea due to cost.
So I am looking for a cheap as possible (or free) way to achieve this. I guess maybe the only way would be an Alexa command?
I do have webcore installed in the ST app and have an IFTTT account. Both have never actually been used.
Does anyone have any thoughts on the easiest way to achieve this?

Quick edit: I should state that it is when I enter the room, if another is already sleeping, that I do not want the main light to turn on. I have positioned the sensor so it does not target the bed.

I can easily see this with a boolean variable and a switch in webcore. I do not use IFTTT so I cannot assist you there. BUT, my tuya lights are not visible to webcore, so it gets convoluted quickly. If your lights are visible to webcore, then I can assist further.

1 Like

Thanks for the reply. Same here. Just my physical sensors and virtual switches show in web core dashboard. No lights :frowning:

Have you tried using modes to restrict the motion automation as suggested last time you asked about this?


It can still be accomplished through Alexa and webcore. But maybe someone has a better idea using Smart Lighting or similar.

1 Like

Thanks Mark. I completely forgot about that thread :blush:
Not sure how i managed to do so.
Going to check it out again now.

FWIW… I use a virtual switch called “Do Not Disturb” to stop lights from turning on. I also use night mode to stop all lights. I also have rules set up that if the door of the room is closed, don’t turn the light on/off. We also sleep with a fan on so if that fan is turned on (connected to a smart outlet) the lights won’t auto operate.

Just a few of the things we do.


Excellent idea - which to me, is the easiest solution. For almost all of my automations, I have set up ‘Override’ switches (actually virtual switches) that can be used to, well, override an automation temporarily. They can be turned on or off via Alexa or by the ST app.


This sounds like a great method for me too. I am lucky (in the automation sense only) that there is only me and the missus and we do not have any pets. We also have a reading light each, controlled by Alexa.
The main ceiling light (that I am looking to control here) is only to be used when neither of us is in bed sleeping. Also luckily, if we don’t go to bed at the same time, it is always me who goes to bed last (I am a bit of a night owl on occasion).
So this automation should not be as difficult as some of the others I am currently reading about.

I think I need to create this override switch, and use an Alexa command for it. Then the missus can say the command when she goes to bed and I can repeat it (As she will often forget) before I go into the bedroom if I am up late.

Now I just need to read more and find some example code I can modify. The whole idea of using a virtual switch to turn on/off another virtual switch is confusing me, but as I have found with all ST things so far, something will eventually click with me.

Do you do that with webcore?

A piece of card which shields the sensor from the bed… My bedroom sensor is placed beside a wardrobe so movement in the bed doesn’t trigger it. Needs careful placement to get it to work. Has worked fine for me for a few years now!

Sorry, my error. I should have stated that it is when I enter the room, if another is already sleeping, that I do not want the main light to turn on. I have positioned the sensor so it does not target the bed.

I understand that everyone case is different. I’m sharing my bedroom Piston that works great for me. Basically, if the door is closed and motion is detected, it sets the room as occupied. You can use that variable’s state to disable or enable automations.

Edit as needed:

1 Like

As was discussed last time, there are already multiple threads in the forum on exactly this issue. Many people just use modes, which is what we do at our house. :wink:

There is a motion sensor near the entrance to the bedroom. During the day, if the motion sensor is triggered, nothing happens.

In the evening, if the motion sensor is triggered, the overhead light turns on.

Once I go to bed, we change the mode on the system from “night“ to “asleep“ (a custom mode that we added) and at that point if the motion sensor is triggered, the overhead light does not come on. Instead, a soft night light on the wall turns on. That keeps my dog from waking me up when he goes in and out of the room at night. Then at 7 a.m., the mode changes back to Day.

But there are lots of other ways to do it and, seriously, at least 4 long threads that already exist on those different ways. :sunglasses:

Go to the quick browse lists in the community-created wiki, go down near the bottom of the page for the “project reports” section, look for the reports by room, and choose the “bedroom“ list. You’ll find the existing threads there. Even the ones that are three or four years old will still be relevant because they are just talking about methods rather than specific devices. :sleeping:

1 Like

Thanks for this, again :slight_smile:
The phrase “mode” is new to me. This is an Alexa thing?
Maybe this is what I should do. My motion sensor is also located at the bedroom entrance. The room is L-shaped so the bed itself and the immediate area around it are invisible to the sensor.

Quick edit: Found modes in the IDE.

No. I use a combination of smart lighting and Automations for the most part. In smart lighting, at the bottom, you can tell Smartthings to not run the rule if a switch is on, or off, depending on how you set it up.

For rooms that have multiple conditions, I’ll use an automation to monitor all of the conditions and then turn on/off a virtual switch that I’ll use in smart lighting.

I have done this in webCore and it’s easier to do but, for me, webCore just isn’t reliable. I find it to miss triggers even when I follow the “best programmimg” practices. I only use webCore for things that I absolutely can’t do any other way.

Others have no problem at all with webCore. So it’s up to you. If you want examples I can post them but we should start a new thread so we don’t hijack this one.

1 Like

No, mode is a SmartThings feature. Location.mode controls regular automations and security.mode controls SmartThings Home Monitor security automations.

When you first set up a SmartThings account there are 3 location.modes automatically created for you: Home, Night, and Away.

But you can go into the IDE and add more if you want. :sunglasses:

So when you create a new automation, selecting the location.mode for when that automation runs is one of the options.

1 Like

I presumed that ST had that, I just could not find it. Thank you! I am so deep into webcore right now that it’s often hard to see the diamonds in the rough.


Thanks very much for this. I may end up using this. For now I do not have a contact sensor on the bedroom door (or anywhere else) as we usually do not close any doors (except on the rare occasion we have guests stay overnight). But this is something I think I must add (this whole ST automation thing is so addictive).


I started off with just wanting the lights to turn off. Then I found CoRE (now webCoRE) and I went absolutely crazy with adding all kinds of devices. My family was furious at first because things would turn off in the middle of them using it or a light turning on when it should remain dark. I quickly realized that I needed more checks and balances and went to using variables and contact sensors in order to zero in on if an automation should run or not based on if the room was occupied. I also added more motions for extra assurance.

Master bypasses are awesome!! I know a lot of people use modes for this but I like using Virtual Switches. I have VS for automation bypass in every room. This way, it doesn’t matter the mode and I can quickly just turn on/off a room’s automation without affecting any other room.