Best logic to automate bedroom lights

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:

3 Likes

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:

5 Likes

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.

3 Likes

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…

2 Likes

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.

3 Likes

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.

2 Likes

Better wife training? :innocent:

7 Likes

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…

2 Likes

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

2 Likes

Got the logic down! Turning off the light when motion is active and contact opens…If I read/watch TV the motion is inactive when the door opens and my wife comes in…So the only time when motion could be active, when the contact opens, is when the room is occupied and someone is near the door…this is the “Ridiculously Automated Bedroom Lights.” I’ll share the code when I’m done if anyone is interested…

4 Likes

So, I decided against reinventing the wheel. Instead I added a small one. I ended up using your Motion Lighting app and created a small app that addresses when my wife comes in the room while I watch TV or read a book…Thanks for sharing your apps!

UPDATE - December 2015. We now have Rule Machine that can better accommodate complex use cases such as bedroom lights.

2 Likes

Hopefully someone can help me with my bedroom automation issue. Here is my scenario. I have 2 bedside lamps connected via a smartthings outlet each. I am thinking of putting a motion sensor because I want them to come on when someone enters the room. Here are some of my questions.

  1. Is there a way to have them shut off when someone exits the room? Does a motion sensor differentiate from entering and exiting?
  2. How to prevent motion detector from triggering in middle of night from moving around or getting up in the middle of the night to go to the restroom.
  3. When you go to bed and they trigger on, what is the best way to shut them off once in bed? Easier to just press “goodnight”, button/minimote, or other “fancy” ideas you have.

Any suggestions are welcome. I am not overly tech savvy so i may need to get more clarification if coding and complex things are recommended.

Thanks!