It is not exactly what you want but can you use an automation condition to disable the light coming on if everything is off downstairs or a door shut that you always shut at night…
I like the motion sensor under the bed idea but it would only be suitable if you don’t share a room.
Similar to Crhass’s idea… Use a Basesian Binary Sensor to detect the probability you’re in bed. It can take several inputs (after 10pm, tv off, lights off, door locked, no motion elsewhere in the house, etc), and calculates a probability that you’re actually in bed. It’s a binary sensor so it would return true or false and would be easy to implement as a condition in your motion sensor/light automation. The example in the documentation I linked above shows how to implement the sensor in this exact situation so it should be pretty helpful.
A less technical way to solve this is to wear a sleep mask so when the lights turn on in the middle of the night you won’t wake up
I use https://github.com/schollz/find3 to determine if both smartphones are in the bedroom for more than X minutes. If not then the light gets turned on.
I implemented it with this Appdaemon App.
I have a similar solution to @gpbenton. When I goto bed, I tell my Google Home and it turns off all the lights and TV, sets the temperature accordingly, and (most importantly) sets the ‘in_bed’ input_boolean in homeassistant to on.
I always charge my phone overnight on a Phillips AS111.
I use llama on the phone to detect that the phone is charging and connected to the bluetooth of the Phillips. When this occurs, I have a rule in llama to call a shortcut (set by http shortcuts) to call the api of HA to set an input_boolean.
Sounds rather complex explaining it all, but it has been working for a while and is very reliable, without having to do anything extra.
I’ve been holding off on all ‘sleep’ automations because I couldn’t find a way to detect when my wife was sleeping. I can’t really train her to press a button before bed because that seems unreasonable (I don’t want to do that either but I would put up with it, she wouldn’t). This solution seems rock solid. I’ll have to see if I can come up with something similar for the iPhone.
You have the iPhone app available. That gives you a sensor that knows if the phone is charging or not. The other way would be to measure the power consumption on the outlet with the charger connecting to a smart plug. That way you know for sure your charging the phone by the bed.
When you unplug your phone you can trigger your morning routine if wanted.
Cheap and easy!
I would go for the weight sensors though. Because it’s more fun
I still would need a way to detect that it’s plugged in the bedroom and not other places.
EDIT: I’ve also noticed that the app does not update the plugged/unplugged state quickly. Took roughly 7 minutes for the app to update the charging status and I forced a location change. Not sure if that triggered it.
Then I have automations to check if me and the wife are home and on the bed. Going to sleep, waking up, going to bathroom during the night… turning the specific lights to on when first one wakes up and another set when both are awake.
I’ve overcome this by building a “night light” script.
It cancels any scripts i had running for automating the lights and turns that automation off, dims my main light down, sets my nanoleaf to a night time sequence and then turns both off after 20 minutes.
I have an added extra automation for the night light script to kick in after room presence has me in the bedroom for 20 minutes after 10pm.
The bedroom light automation is then turned back on in to my wake up sequence which is triggered by an alarm on my amazon echo/phone.
about the iPhone sensor, it is horribly out of order most of the time… but the outlet power meter is exactly what I use. Switches off automatically when 100% powered. Apple can’t do that yet.
And about not switching the lights on, I’ve set that in the Hue app on the motion sensor. Don’t switch the sensor off, but simply don’t turn on the lights during the sleep time period.
I use the motion sensor to do switch on the power to my bed lights, that have a small led pointing to the floor. So when we have to get out of bed, we’re not in the black dark, but can faintly see where we’re going turns off after 1 minute of no movement with a wait_template.
Why don’t you use a smart power plug to detect when phone is plugged in. That’s how I handle it for my wife’s iPhone she would simply not play the need to press anything game before bed.
that’s a cool way! YOu have one or more then one sensor below the bed? In a usual setting you have two sides where you put down your feet (left and right). MAybe putting the sensor centrally (towards the third side) will cover both left and right?