Has anyone figured out how to pull Google Nest Hub (2nd gen) 's sleep detection variables into Home Assistant for automation of their sleep input boolean? Also the temperature of the room?
“Sleep Sensing uses Motion Sense to track the sleep of the person closest to the display. With a low-energy radar, Motion Sense detects movement and breathing. Other sensors in Nest Hub detect sounds like snoring and coughing, and environmental factors like light and temperature in the room. That’s how Sleep Sensing determines not just when you went to bed and how long you slept, but also the quality of your sleep.”
Unsure of how I will exploit it yet, but I have realized that you can ‘play relaxing sounds’ with a sleep timer whose ‘auto-off’ response can detect when the user falls asleep. This ‘relaxing sound’ track can be seen by the media player in HA.
In theory, you could create a Google routine to start the track at bedtime, use a HA automation to silence the track, and another automation to trigger when the track was stopped, signifying the user’s sleep onset event.
I did not. It was a little too complex and detailed to work predictably for me. I think it could still be done though.
I presently have satiated my general needs with several automations to turn on sleep mode (only when sleep mode is off) and turn off sleep mode (only when sleep mode is on) triggered by a number of conditional events. These can be used to target specific individuals’ sleep routines/patterns, then set a group ‘anyone sleeping’ boolean.
Sleep mode is activated when:
Bedroom lamp changes on to off for seven minutes near bedtime
Bedroom motion sensor is activated near bedtime
Phone is connected to charger near bedtime
The time is 11:30 PM (or the latest estimated bedtime)
Google Home ‘Goodnight’ routine is activated by voice command
Google Home sleep sounds are playing
The time is 08:30 AM when working night-shift
Sleep mode is deactivated when:
The time is 7:30 AM (or the latest estimated awake time)
The time is 16:30 PM when working night-shift
Google Home ‘Good morning’ routine is activated by the voice command
Side door opens in the morning (to let the dog out)
Bedroom lamp turns on for five minutes in the morning
Phone is disconnected from charging
Google Home alarm clock alarm set time is reached (template)
Google Home sensor.bedroom_display_alarms state changes to unavailable (HACS Google Home integration)
Thus sleep mode is toggled by the first action from these lists.