Guest Mode That Survives a Restart: A Small, Inspectable State Machine
Most guest modes fail for the same reason most home automation fails: they are a pile of overrides with no single source of truth. Someone flips a toggle, three automations get disabled by hand, a fourth keeps firing because nobody remembered it existed, and when the guests leave you are left reconstructing which switches you turned off. The fix is not more automation. It is a smaller, more inspectable design: one named state, explicit conditions on the routines that actually matter, and an exit path you can verify.
This is a procedure, not a product recommendation. It assumes a local-first stack — Home Assistant with Zigbee2MQTT, Z-Wave JS, ESPHome, or MQTT entities — where the guest-mode flag lives on your own hardware and does not depend on a vendor cloud being reachable.
Why one flag beats a pile of overrides
A toggle helper (input_boolean) stores an on/off state that is not tied to a physical device. Home Assistant’s documentation describes exactly this use: you can create a toggle helper to enable or disable a set of automations, mark guest mode as active, or track whether you are on vacation (Input boolean integration).
The value of a single flag is diagnostic, not aesthetic. When a routine misbehaves while guests are present, there is exactly one place to look: did the routine read the flag, and was the flag in the state you expected? If you instead disable automations individually, the question becomes “which of these twelve switches is in the wrong position,” and the answer is buried in a dashboard you built six months ago.
If you need more than two states — say, daytime visitors versus overnight guests — a dropdown helper (input_select) stores one value chosen from a list you define, and the documentation gives “Visitors” and “Visitors with kids” as example options (Input select integration). That is a reasonable upgrade later. Start with the boolean; a two-state flag is easier to reason about and easier to verify.
Step 1: Create the flag and decide its restart behavior
Create the helper under Settings → Devices & services → Helpers → Create helper → Toggle. Name it something you will recognize in a trace, like input_boolean.guest_mode.
Then make a deliberate decision about what happens after a restart. By default, a toggle helper restores the state it had before Home Assistant stopped; if there is no state to restore, it starts as off (Input boolean integration). For guest mode, restore-previous is usually the right choice: if guests are still in the house when you install an update, you do not want the flag silently resetting to off and your motion lights resuming their normal behavior at 2 a.m.
The tradeoff is the opposite failure: if the flag was left on and you forgot, it stays on after a restart. That is why the exit path in Step 4 matters. Pick one behavior and write it down; do not leave it to whatever the default happens to be.
Step 2: Gate only the routines a guest would trip over
The instinct is to disable everything. Resist it. A house where nothing works feels broken to a guest, and a house where everything is disabled is harder to bring back because you have more state to verify on exit.
Gate the routines that produce surprising behavior: motion-driven lighting that turns a lamp back on after a guest switches it off, scheduled shade opening, vacuum and mower schedules, and any presence-based routine that assumes the occupants are you. Leave climate safety limits, smoke and leak notifications, and anything a guest would reasonably expect to keep working.
The mechanism is a state condition on the flag. Home Assistant’s documentation shows the pattern directly: a condition checks whether something is true at that moment, and if it is not met, the actions after it in the same sequence do not run — at the top level of an automation, this stops the automation (Input boolean integration). A practitioner write-up of the same approach describes creating a toggle helper called Guest Mode and adding a condition to selected automations that the toggle must be off for the automation to run (Michael Sleen, guest mode).
A minimal condition block looks like this:
condition:
- condition: state
entity_id: input_boolean.guest_mode
state: "off"
Put it at the top level of the automation, not buried inside a branch, so the trace shows the condition result immediately. If you want the gate to be visible in the editor rather than only in YAML, the same condition is available through Add condition → Entity → State.
One alternative worth knowing: a step can be disabled with enabled: false, and enabled can be a template rendered each time the step is about to run; if the result is false, Home Assistant skips the step (Home Assistant building blocks). That is useful for skipping a single action, but for guest mode a top-level condition is easier to read in a trace. Use the condition unless you have a specific reason to skip one step inside an otherwise-running automation.
Step 3: Choose the automation mode on purpose
This is where guest mode quietly breaks. A guest presses a button twice, or opens a door, closes it, and opens it again. Whether the second trigger does anything depends on the automation’s mode, and the default is not always what you want.
Home Assistant documents four modes (Automation modes):
- Single (default): does not start a new run while the automation is running, and logs a warning.
- Restart: stops the current run, including a delay or wait that is running, and starts a new run only if conditions are met.
- Queued: starts the new run after all previous runs finish, in the order they were started.
- Parallel: starts a new, independent run right away.
For a gated routine that a guest may trigger repeatedly, the choice matters in concrete ways. A hallway light automation that turns on for a fixed period and then off behaves very differently under single (second press ignored, warning logged) than under restart (timer resets, light stays on longer). Neither is wrong; the point is that you should know which one you picked. If the second press is silently dropped and the guest is standing in a dark hallway, the log warning is the only evidence you will have later.
Two practical notes. First, single mode with a delay at the end is the documented way to throttle an automation to run at most once per interval, and the warning can be silenced with max_exceeded: silent (Automation modes). That is a reasonable pattern for a doorbell-style routine. Second, queued mode is the documented choice when an automation controls a device that cannot handle several commands at once (Automation modes). If a guest’s repeated presses are producing overlapping commands to a single device, queued is the safer default.
Do not change modes across the whole house to fix one guest-mode symptom. Change the mode of the specific routine that misbehaves, and note why in the automation’s description field.
Step 4: Make the exit path deterministic
If you want guest mode to turn itself off after a fixed period, do not use a long delay inside an automation. A Home Assistant restart stops all automation runs, and an in-progress delay, wait, or trigger duration is lost; the automation does not continue after the restart (Automation modes). A guest mode that was supposed to expire overnight will simply stay on if you restart the system in the middle of the window.
Use a timer helper instead. A timer is its own entity with idle, active, and paused states, and it returns to idle when it finishes, is canceled, or has not been started yet (Timer integration). Timers can be restored to their correct state and time on startup and restarts when configured with the restore option (Timer integration). The documented pattern is to replace the delay with a Start a timer action and create a second automation triggered on Timer finished that runs the remaining actions (Automation modes).
Know the limitation before you rely on it. If a timer runs out while Home Assistant is off, the Timer finished trigger does not react when Home Assistant starts again (Automation modes; Timer integration). So an auto-expiry that depends on the timer firing is not guaranteed across a long outage. If that gap matters to you, add a second, independent check: a time trigger that runs at a fixed hour and turns the flag off if it is still on. That is a belt-and-suspenders design, and it is honest about the failure mode rather than pretending the timer covers it.
The exit checklist itself should be short enough to actually run:
- Turn the flag off.
- Confirm the gated routines are enabled and their conditions now evaluate true.
- Confirm no timer is left active.
- Confirm any guest dashboard or guest account is not left logged in.
On the last point: a practitioner write-up recommends creating a guest user account without Administrator privileges for a guest tablet, and restricting dashboard visibility per user (Michael Sleen, guest mode). That is a reasonable practice, but treat it as a recommendation from one practitioner, not a documented guarantee of per-entity permissions. The same write-up is candid that a guest tablet dashboard “doesn’t get a ton of use” because it requires a behavior change from the guest. Plan for the tablet to be optional, not load-bearing.
Step 5: Keep physical controls authoritative
Guest mode should reduce surprising automatic behavior, not remove a guest’s ability to operate a lamp or a fan by hand. If a guest flips a wall switch and an automation immediately reverses it, the guest will conclude the house is broken — and they will be right from their point of view.
This is the strongest argument for gating the motion-driven and schedule-driven routines rather than disabling everything. A guest who can turn on a light at the switch and have it stay on does not need to understand your dashboard. A guest who cannot is being asked to learn your system, which is the opposite of what guest mode is for.
There is a case where the honest answer is a mechanical timer or a plain switch. If the only thing you need is “the porch light stays on for two hours,” a $15 mechanical timer does that with no state to restore, no mode to choose, and no trace to read. Guest mode earns its complexity when you have several routines that genuinely conflict with visitors. If you have one, use the simpler device.
Diagnostic path: why did a routine ignore guest mode?
When a routine fires during guest mode, the question is almost always one of three things: the routine never had the condition, the condition evaluated false because the flag was in the wrong state, or the run was dropped by the automation mode.
Home Assistant documents the tools for this: you can test automations by running them or a single step and reading the trace, and the troubleshooting docs map common problems by symptom (Automations documentation). The trace shows each step and the condition results, which is how you distinguish “condition not present” from “condition present and false.”
A short procedure:
- Open the automation’s trace for the run in question. If there is no trace, the automation did not start — check the trigger, not the condition.
- Read the condition result on
input_boolean.guest_mode. If it is missing, the condition was never added to this automation. If it is false, check the flag’s current state and its history. - Check the log for mode warnings. In single mode the warning is “Already running”; in queued and parallel modes it is “Maximum number of runs exceeded” (Automation modes). A dropped run looks like nothing happened, and the warning is the only evidence.
- If a step failed, remember that by default an automation or script stops when a step fails, and the run is marked as failed with the error logged;
continue_on_errorlets the next step run instead (Home Assistant building blocks). A failed notification step can stop the rest of the sequence before it reaches the action you were expecting.
If you are auditing a whole installation rather than one automation, the same discipline applies at a higher level: list every automation that touches lighting, shades, climate, or cleaning, and mark which ones read the guest flag. The ones that do not are your candidates for either gating or an explicit decision to leave them alone. A broader audit procedure is described in How to Audit the Small Systems That Quietly Run Your Week.
Graceful degradation when the flag or the network is unavailable
The guest flag is a local helper, so it does not depend on MQTT, Zigbee2MQTT, Z-Wave JS, or a vendor cloud to hold its state. That is the main reliability argument for using a helper rather than a cloud scene or a vendor app’s guest setting. The flag survives a broker outage because it was never on the broker.
What does depend on the network is everything the gated routines control. If Zigbee2MQTT is down, a motion sensor’s state is unavailable, and an automation that would normally be gated by guest mode may simply not trigger at all. That is usually the safer failure: no surprise behavior. The failure to watch for is the opposite — a routine that fires on a stale or restored state after the network comes back. If you see that, check whether the trigger is a state change that was queued during the outage, and consider whether the routine needs a condition on the entity being genuinely available, not just present.
I have not seen a documented case of the input_boolean state itself being lost when the recorder or history database is unavailable, and I would not claim it is impossible. Treat the flag as reliable but not infallible: the exit checklist in Step 4 is what catches a flag that ended up in the wrong state, regardless of why.
What this design does not do
It does not guarantee that visitors will be unconfused. A guest who has never seen a smart home will still press a switch and expect a light. What the design does is make the system’s behavior inspectable: one flag, explicit conditions, deliberate modes, and a timer with a known limitation. When something goes wrong, you can find out why in a trace instead of guessing.
It also does not replace the judgment call about whether guest mode is worth building at all. If your routines are few and your guests are infrequent, a plain switch and a note on the counter may serve you better. Build the state machine when the conflicts are real and recurring, and keep it small enough that you can still explain it to yourself six months from now.