Deze Home Assistant slaapstand automatisering herkent automatisch wanneer bewoners gaan slapen — op basis van thuis-status en het opladen van hun telefoon — en stuurt daarop de nachtstand van je hele huis aan: verlichting, thermostaat, TV en telefoon-notificaties.
Concreet regelt deze automatisering-set:
- Per bewoner automatisch detecteren of diegene slaapt (thuis + telefoon aan de oplader)
- Eén globale slaapstatus voor het hele huishouden, inclusief een verlengd nachtvenster bij nachtdienst
- Adaptive Lighting automatisch in nachtmodus zetten in het hele huis
- Thermostaat omlaag zodra iedereen slaapt
- Telefoon automatisch op “niet storen” zetten zodra iemand thuis gaat slapen
- TV automatisch uitzetten bij het slapengaan
- Slaapkamerverlichting die meebeweegt met wie er slaapt: uit, gedimd, of fel — afhankelijk van de situatie
In dit artikel krijg je een volledig werkend voorbeeld van alle 7 losse automatiseringen die samen deze flow vormen, inclusief uitleg zodat ook beginners dit zelf kunnen opzetten. Onderaan kun je de complete, kant-en-klare YAML ook downloaden.
De 7 automatiseringen zijn: slaapstatus per bewoner (x2), globale slaapstatus en nachtstand, thermostaat bij slapen, niet-storen bij slapen, TV uit bij slapen, en slaapkamerverlichting op basis van slaapstatus.
⚙️ Wat heb je nodig voor deze slaapstand-automatisering?
In Home Assistant:
person-entiteiten voor elke bewoner- Een batterij-status sensor per telefoon (bijv. via de Home Assistant Mobile App-integratie) die aangeeft of de telefoon oplaadt
- Adaptive Lighting-integratie met een sleep-mode-switch per ruimte (optioneel, maar gebruikt in dit voorbeeld voor automatische nachtstand-verlichting)
- Een
climate-entiteit voor de thermostaat - Een
media_player-entiteit voor de TV - De Home Assistant Mobile App voor het versturen van DND-commando’s naar een telefoon
- Sensoren voor beweging/schemer/bed-bezetting in de slaapkamer (voor de laatste automatisering)
Zelf aan te maken helpers:
input_boolean.gebruiker_1_slapen— slaapstatus van bewoner 1input_boolean.gebruiker_2_slapen— slaapstatus van bewoner 2input_boolean.slapen— globale slaapstatus van het huishoudeninput_boolean.nachtdienst— geeft aan of iemand nachtdienst heeft (verlengt het nachtvenster waarbinnen slapen wordt herkend)
🧩 De 7 automatiseringen
Automatisering: Slaapstatus per bewoner bepalen
Wat doet dit: herkent automatisch of een bewoner slaapt, op basis van “thuis” + telefoon aan de oplader. Dit draait twee keer, één keer per bewoner (verschillende telefoons kunnen een net iets andere batterij-sensor hebben, bijv. “Charging” vs “ac”).
Hoe maak je dit:
yaml
trigger: state
entity_id: person.gebruiker_1
Plus een trigger op de batterij-status-sensor van de telefoon. Conditie/logica: is_state('person.gebruiker_1', 'home') and opladen. Zet bij “waar” de bijbehorende input_boolean.gebruiker_1_slapen aan, anders uit.
Automatisering: Globale slaapstatus en nachtstand
Wat doet dit: combineert de individuele slaapstatussen tot één huishoud-brede input_boolean.slapen, en zet bij het ingaan/verlaten van slaapstand automatisch de Adaptive Lighting sleep-mode aan/uit in het hele huis.
Hoe maak je dit:
yaml
trigger: state
entity_id:
- input_boolean.gebruiker_1_slapen
- input_boolean.gebruiker_2_slapen
- input_boolean.nachtdienst
Plus twee tijd-triggers (bijv. 21:00 en 09:00) om het nachtvenster te bewaken. Logica: iedereen die thuis is moet slapen (of, als er maar één persoon thuis is, die ene) én de tijd moet binnen het nachtvenster vallen (of er is nachtdienst actief, dan geldt geen tijdslimiet). Zet bij “aan” input_boolean.slapen aan en een korte delay, gevolgd door het aanzetten van alle switch.adaptive_lighting_sleep_mode_*-entiteiten. Bij “uit”: omgekeerd.
Automatisering: Thermostaat bij slapen
Wat doet dit: zet de woonkamerthermostaat lager zodra het huishouden in slaapstand gaat, en herstelt het normale schema zodra dat weer voorbij is.
Hoe maak je dit:
yaml
trigger: state
entity_id: input_boolean.slapen
Bij “aan”: climate.set_temperature naar bijvoorbeeld 17 graden. Bij “uit”: een button.press op de “resume schedule”-knop van je thermostaat-integratie (bijv. Tado).
Automatisering: Niet-storen bij slapen thuis
Wat doet dit: zet de telefoon van een bewoner automatisch op “niet storen” en dimt het scherm zodra diegene thuis is én het huishouden slaapt — en zet dit weer normaal zodra dat niet meer zo is.
Hoe maak je dit:
yaml
trigger: state
entity_id:
- input_boolean.slapen
- person.gebruiker_2
Conditie: is_state('person.gebruiker_2', 'home') and is_state('input_boolean.slapen', 'on'). Actie: stuur via de Home Assistant Mobile App-notify-service de commando’s command_dnd (priority_only), command_auto_screen_brightness (uit) en command_screen_brightness_level (laag). Bij “niet meer slapen”: zet DND en auto-brightness weer terug naar normaal.
Automatisering: TV uitzetten bij slapen
Wat doet dit: pauzeert en zet de woonkamer-TV automatisch uit zodra het huishouden gaat slapen (of als er niemand meer thuis is, of bij lang op de TV-afstandsbediening drukken).
Hoe maak je dit:
yaml
trigger: state
entity_id: input_boolean.slapen
to: "on"
Actie: eerst media_player.media_pause, na een korte delay gevolgd door media_player.turn_off. Zet ook eventuele “aan het TV-kijken”-helpers uit en schakel de TV zelf via een afstandsbediening-entiteit uit als die nog aan staat.
Automatisering: Slaapkamerverlichting op basis van slaapstatus
Wat doet dit: stuurt de slaapkamerverlichting op basis van een combinatie van beweging, schemer, override en wie er precies slaapt — helemaal uit als niemand in de kamer is, gedimd oranje licht als één bewoner slaapt en de ander nog niet, en fel licht als er een handmatige override actief is of niemand slaapt terwijl het wel schemerig is.
Hoe maak je dit:
yaml
trigger: state
entity_id:
- input_boolean.pir_slaapkamer
- input_boolean.override_slaapkamer
- input_boolean.schemer
- input_boolean.slapen
- input_boolean.gebruiker_1_slapen
- input_boolean.gebruiker_2_slapen
- input_boolean.bed_bezet
Bepaal met een paar hulp-variabelen: of er een reden is om licht te tonen (beweging/override + schemer), of iedereen slaapt, of één iemand slaapt terwijl het huishouden nog niet in globale slaapstand staat, en of er een “fel licht”-situatie is (override of niemand slaapt terwijl het al schemerig is). Stuur op basis daarvan de losse lampen en de ledstrip aan met passende helderheid/kleur.
🧠 Gebruikte templates
- Opladen-detectie per telefoon-type — verschillende telefoons/merken geven de oplaadstatus soms net anders door (bijv.
Chargingvsac); de template normaliseert dit naar een simpele true/false. - Nachtvenster-berekening — bepaalt of de huidige tijd binnen het nachtvenster valt, met een uitzondering voor nachtdienst.
❓ Veelgestelde vragen
Werkt dit ook met maar één bewoner? Ja, laat dan gewoon de tweede “slaapstatus per bewoner”-automatisering en de bijbehorende verwijzingen weg, en gebruik alleen de status van de ene bewoner als basis voor de globale slaapstatus.
Heb ik Adaptive Lighting per se nodig? Nee, dat onderdeel is optioneel — je kunt de sleep-mode-switches weglaten en in plaats daarvan direct lampen dimmen of uitzetten in de “globale status”-automatisering.
Wat als iemand’s telefoon ’s nachts niet oplaadt? Dan wordt die persoon niet als “slapend” herkend door deze specifieke detectiemethode. Je kunt de trigger uitbreiden met bijvoorbeeld een bed-sensor of een handmatige knop als extra of alternatieve manier om slaapstand te activeren.
Hieronder kun je bovenstaande flow downloaden incl. de genoemde helpers en de volledige YAML als Word-bijlage.
De genoemde helpers kun je zelf aanmaken in Home Assistant onder apparaten en diensten -> helpers -> Helper toevoegen.
Let op gebruik is op eigen risico!!
EN — 🌙 Home Assistant sleep mode automation: 7 automations for automatic sleep detection and night mode
This Home Assistant sleep mode automation automatically detects when residents go to sleep — based on presence and whether their phone is charging — and uses that to drive your whole house’s night mode: lighting, thermostat, TV, and phone notifications.
Specifically, this automation set handles:
- Automatically detecting per resident whether they’re asleep (home + phone charging)
- One household-wide sleep status, including an extended night window for night-shift work
- Automatically switching Adaptive Lighting into sleep mode throughout the house
- Lowering the thermostat once everyone’s asleep
- Automatically putting a phone into “do not disturb” once a resident goes to sleep at home
- Automatically turning off the TV at bedtime
- Bedroom lighting that adapts to who’s asleep: off, dimmed, or bright — depending on the situation
This article gives you a fully working example of all 7 individual automations that make up this flow, with explanations so beginners can set it up too. At the bottom, you can also download the complete, ready-made YAML.
The 7 automations are: per-resident sleep status (x2), global sleep status and night mode, thermostat at bedtime, do-not-disturb at bedtime, TV off at bedtime, and bedroom lighting based on sleep status.
⚙️ What do you need for this sleep mode automation?
In Home Assistant:
personentities for each resident- A battery status sensor per phone (e.g. via the Home Assistant Mobile App integration) indicating whether it’s charging
- Adaptive Lighting integration with a sleep-mode switch per room (optional, but used in this example for automatic night-mode lighting)
- A
climateentity for the thermostat - A
media_playerentity for the TV - The Home Assistant Mobile App for sending DND commands to a phone
- Motion/twilight/bed-occupancy sensors in the bedroom (for the last automation)
Helpers to create yourself:
input_boolean.gebruiker_1_slapen— sleep status of resident 1input_boolean.gebruiker_2_slapen— sleep status of resident 2input_boolean.slapen— household-wide sleep statusinput_boolean.nachtdienst— indicates whether someone is on a night shift (extends the window in which sleep is recognized)
🧩 The 7 automations
Automation: Determine sleep status per resident
What it does: automatically detects whether a resident is asleep, based on “home” + phone charging. This runs twice, once per resident (different phones can report charging state slightly differently, e.g. “Charging” vs “ac”).
How to build it:
yaml
trigger: state
entity_id: person.gebruiker_1
Plus a trigger on the phone’s battery-state sensor. Logic: is_state('person.gebruiker_1', 'home') and charging. When true, turn on the corresponding input_boolean.gebruiker_1_slapen, otherwise turn it off.
Automation: Global sleep status and night mode
What it does: combines the individual sleep statuses into one household-wide input_boolean.slapen, and automatically switches Adaptive Lighting sleep mode on/off throughout the house when entering/leaving sleep mode.
How to build it:
yaml
trigger: state
entity_id:
- input_boolean.gebruiker_1_slapen
- input_boolean.gebruiker_2_slapen
- input_boolean.nachtdienst
Plus two time triggers (e.g. 21:00 and 09:00) to guard the night window. Logic: everyone who’s home must be asleep (or, if only one person is home, that one) and the time must fall within the night window (or a night shift is active, in which case no time limit applies). On “on”: turn on input_boolean.slapen, then after a short delay, turn on all switch.adaptive_lighting_sleep_mode_* entities. On “off”: the reverse.
Automation: Thermostat at bedtime
What it does: lowers the living room thermostat once the household enters sleep mode, and restores the normal schedule once it ends.
How to build it:
yaml
trigger: state
entity_id: input_boolean.slapen
On “on”: climate.set_temperature to e.g. 17 degrees. On “off”: a button.press on your thermostat integration’s “resume schedule” button (e.g. Tado).
Automation: Do-not-disturb at bedtime
What it does: automatically puts a resident’s phone into “do not disturb” and dims the screen once they’re home and the household is asleep — and reverses this once that’s no longer the case.
How to build it:
yaml
trigger: state
entity_id:
- input_boolean.slapen
- person.gebruiker_2
Condition: is_state('person.gebruiker_2', 'home') and is_state('input_boolean.slapen', 'on'). Action: via the Home Assistant Mobile App notify service, send the commands command_dnd (priority_only), command_auto_screen_brightness (off), and command_screen_brightness_level (low). When no longer asleep: reset DND and auto-brightness back to normal.
Automation: Turn off TV at bedtime
What it does: automatically pauses and turns off the living room TV once the household goes to sleep (or when nobody’s home anymore, or on a long press of the TV remote).
How to build it:
yaml
trigger: state
entity_id: input_boolean.slapen
to: "on"
Action: first media_player.media_pause, then after a short delay, media_player.turn_off. Also turn off any “watching TV” helpers and switch the TV itself off via a remote-control entity if it’s still on.
Automation: Bedroom lighting based on sleep status
What it does: drives the bedroom lighting based on a combination of motion, twilight, override, and exactly who’s asleep — fully off when nobody’s in the room, dimmed orange light when one resident is asleep and the other isn’t yet, and bright light when a manual override is active or nobody’s asleep while it’s dusky.
How to build it:
yaml
trigger: state
entity_id:
- input_boolean.pir_slaapkamer
- input_boolean.override_slaapkamer
- input_boolean.schemer
- input_boolean.slapen
- input_boolean.gebruiker_1_slapen
- input_boolean.gebruiker_2_slapen
- input_boolean.bed_bezet
Using a few helper variables, determine: whether there’s a reason to show light (motion/override + twilight), whether everyone’s asleep, whether one person is asleep while the household isn’t yet in global sleep mode, and whether there’s a “bright light” situation (override, or nobody asleep while it’s already dusky). Drive the individual lamps and the LED strip accordingly with matching brightness/color.
🧠 Templates used
- Charging detection per phone type — different phones/brands sometimes report charging state slightly differently (e.g.
Chargingvsac); the template normalizes this into a simple true/false. - Night window calculation — determines whether the current time falls within the night window, with an exception for night-shift work.
❓ Frequently asked questions
Does this work with just one resident? Yes — simply omit the second “sleep status per resident” automation and its references, and use just that one resident’s status as the basis for the global sleep status.
Do I strictly need Adaptive Lighting? No, that part is optional — you can skip the sleep-mode switches and instead directly dim or turn off lights in the “global status” automation.
What if someone’s phone doesn’t charge overnight? Then that person won’t be recognized as “asleep” by this specific detection method. You can extend the trigger with, for example, a bed sensor or a manual button as an extra or alternative way to activate sleep mode.
You can download the flow above, including the mentioned helpers and the full YAML as a Word attachment, below.
You can create the mentioned helpers yourself in Home Assistant under Settings -> Devices & Services -> Helpers -> Add Helper.
Please note: use is at your own risk!!

Geef een reactie