Best logic to automate bedroom lights

So I have been trying to find a way to automate the lights in the bedrooms but cannot seem to find the logic that could account for the multitude of conditions that occur in the bedrooms. Motion sensor came the closest, but that too had its flaws. (e.g. I had to move around when reading a book so that lights would stay on). Was wondering what logic others use to automate their lights?!

It’s just going to depend on the use case. I have multiple parallel controls for the bedroom. I use echo the most. It fits the randomness of my own schedule well.

I also have a motion sensor set up as a touchless switch on the nightstand pointing towards the bed. It doesn’t trigger if I just get out of bed, I have to do a wave over it. But that gives me a totally silent means of control. I combine that with mode so that before bedtime it triggers the overhead light, and once the mode is “asleep” it triggers a softer nightlight.

Smarttiles works on the tablet dashboard if I want to use that.

And I have a SmartenIT 3 toggle on the nightstand which I also used to trigger some things. That one can be used in the dark and quietly.

But again, that’s just what works for me.

1 Like

I forgot to mention, once I had home automation, one of the best things I did was to add additional lights to the bedroom to address different use cases. I had never done this before, because since I am quadriparetic, there are very few lights I could use anyway. And for my service dog the wall switch light was pretty much it.

Now I have A table lamp on the nightstand, the regular overhead ceiling fixture, another table lamp on the desk, and the nightlight.

All of these are networked, which means I can control all of them. (Yay!)

I think this can also address some of the motion sensor issues. If you have a reading light that is not controlled by the motion sensor, then that one can stay on while you’re reading. And you could still have a ceiling light go off with the motion sensor. So that just adds some more options, especially if there’s a really easy way to turn things off without having to squirm around in bed too much. (Go, echo!) :sunglasses:

So many options to “automate”. What do you want them to do? It seems simple, but you already started with one thing not everyone does, “read in bed”.

What else do you want to happen? I work with robots at my day job, and they can make you toast and coffee if you want, but you have to program them to do so. You have to specify your requirements.

I don’t automate my bedroom lights yet, because it is one of the more random rooms in the house. To begin, a pressure sensor for the bed, and multiple motions would be required at least I think. I have also considered using the light switches themselves as automation to know when we were going to sleep, because I don’t think any sensor can figure that out without strapping an accelerometer to the occupants, one of which I don’t think would accept. She’s tolerant, even supportive of my hobby, but there are limits. :smile:


I have a motion sensor setup so that i will only trigger as I enter the room. Movement within the room does not turn on the light. I then have a timer to turn off the light late at night. If I do go to bed earlier, then I just tell Alexa to turn off the light. In the morning, the alarm turns on the light and Sonos for me.

Thinking just now to myself, I just realized that both an accelerometer and a pressure switch will have problems. Pressure switch won’t realize we are reading, and accelerometer would take tossing and turning as being awake. So would a motion detector for that matter. Brain hurts.

1 Like

Welcome to my world. I tried all but strapping the accelerometers on us. So thanks for debunking that idea because I was just about to do it LOL…I would say the bedrooms are the most peculiar rooms in the house. I have automated all others (and when I say automated, I mean lights coming on/off without our input - voice or touch). I do have an Echo that works in most use cases and a multi sensor that I use both as accelerometer when the door is not fully closed and the open/close when the door is shut. But I keep running in all sorts of exceptions that make my brain hurt :slight_smile: That’s why I wanted to see how others do it…

That’s naughty of you to ask. :wink:


I use motion sensors in our bedroom, and bedside Minimotes. The motion-lighting app that I use (my own, see here: Motion Lighting) has a disable-motion function (using a virtual switch). When one of us goes in to read, we use the Minimote to set the lights to an appropriate setting, and disable motion on/off. Later, when it’s time to turn out the lights, the Minimote is the tool for that. I use a scheduled on to turn the disable switch off in the morning. This works well for us. The Minimote also has a “nap” button, that disables motion, and turns off the lights.

I’m finding that motion-disable is a very useful feature. I used to use a special mode to do this, but found that gets too complicated, and doesn’t generalize at all. Hence, added the motion-disable function to my basic lighting apps.


I’ve just started tinkering, but for us right now, minimal automation in the bedroom. I have a “when things start happening” for weekday mornings at the time of our alarm, which seems to work well–alarm goes off, wife gets up to turn it off, motion is sensed and the light comes on. It actually triggers a mode change, which then triggers the “gradual wake up” smart app. Once that’s done (10 minutes), a light in the living room and kitchen both turn on so I can find my way to the coffee! I also revived an old Nook Color to sit on my wife’s side of the bed running SharpTools for widgets to control the lights, if she wanted to turn on/dim/whatever. What I haven’t figured out how to nail down yet is how to handle this when we’re home during the week but on vacation.

Other than that, my other automations so far are presence-based. I work from home, so if I’m detected (via mobile presence) to be home after 7:15 or so, but my wife isn’t, any lights not in the office are turned off. Our house is small, so the concept of motion to keep lights on isn’t compelling–I can SEE from the living room if the office or bedroom lights are on, and that’s easy to fix with a minimote, Alexa, tablet, phone…


Brilliant! The non-mode-based motion-disable feature is what I am missing from my set up. I looked at the app you mentioned, but I couldn’t figure out how you disable the motion without using the mode change? Would you mind
elaborating on that?

It’s straight forward:

Allow selection of the disable switch:

input("disabled", "capability.switch", title: "Select switch to disable motion", required: false, multiple: false

Subscribe to the disable switch in initialize():

subscribe(disabled, "switch", disabledHandler)

disabledHandler(evt) does this:

state.motionDisabled = evt.value == "on"

Then, in all of the methods that handle motion events, simply add this at the beginning of each:

if(state.motionDisabled) return

And, be sure to initialize state.motionDisabled in initialize():

state.motionDisabled = (disabled) ? disabled.currentSwitch == "on" : false

This assumes you are handling all of the motion events in the app.

1 Like

I have a bed that inclines. I have installed a multi purpose sensor to the frame so that the switch opens when I incline the bed. Then I have an event on the hub that sets my lights accordingly.


Great idea, I have he adjustable bed as well And great idea to have event occur when I move it to sleeping position.

1 Like

I use a bed side minimote too. I use mine to set the house into home or night mode.

Yep, same with us. I also have a scheduled “Goodnight” much later than we go to bed, just in case. When we are out late, my “I’m Back” Routine runs a small app to decide whether to put the house into Day or Evening mode, as we’d want a bit more light when getting home than normal.

I’ve been working on a smart app for my bedroom lights, but I got stuck on “accidental” part of turning the lights off.

Here is the use case:

Turn switch on when contact opens and off when closes, unless one or more switches are ON, in which case, turn off the switch (or all switches) when contact closes (the second time) and motion stops.

This works well for the following scenario:

When I open bedroom door, the light comes on (it would turn off when motion stops, unless I turn on another switch within 5 minutes). If I decide to read or watch TV, the bedroom light will continue to stay on because the reading lamp or TV switch are now on.

When I am done reading/watching TV, I open the door (nothing happens - because switches are on) but when I close it (second close event), the light switch, the TV switch and/or the lamp will turn off (when motion stops).

The part I struggle with, is when my wife comes in the room and triggers the lights OFF event (door closed the second time & motion stops). Any thoughts how I can code to avoid this?

@bravenel, basically I am trying to find a way to turn off the lights (without touching a switch) if I vacate the room and the motion is disabled.

Update: final use case…

Turn switch on when contact opens and off when door closes OR motion stops after x minutes, unless one or more switches are ON, in which case, turn off the switch (or all switches) when contact opens and motion is active.


Better wife training? :innocent:


You might get more refined in the way you deal with motion disabling. This is just a logic problem, but you have a complicated logic diagram going on…


It’s definitely my fault here, I trained her not to worry about turning the lights off behind her, and now that I learned a new trick (motion disable) many lights are staying on. Oops