Files
haos-blueprints/Common/Time Of Day Selector/README.md
T
alexei.dolgolyov fafcf116be feat: add Presence Scene Controller and Time Of Day Selector blueprints
- Presence Scene Controller: per-room presence-aware time-of-day scenes
  with vacant/sleep scenes and Motion Light coexistence
- Time Of Day Selector: event-driven state machine that sets an
  input_select when a configured time entity fires
- List both blueprints in the root README
- Bump version to 2.13.0
2026-05-27 13:10:03 +03:00

52 lines
2.8 KiB
Markdown

# Time of Day Selector Blueprint
Event-driven blueprint that updates an `input_select` based on a list of time triggers. Each trigger entity is mapped to a state name; when the trigger fires, the matching state becomes active.
This is a sibling to the [Time Of Day Controller](../Time%20Of%20Day%20Controller/README.md) blueprint, which uses minute-by-minute polling and threshold comparison. Use this one when you want exact event-based firing and the ability to attach multiple trigger sources (e.g. a sun event **or** a manual forced time) to the same state.
## How It Works
- Define a list of **time triggers**`input_datetime` helpers and/or timestamp sensors such as `sensor.sun_next_rising` / `sensor.sun_next_dusk` / `sensor.sun_next_midnight`.
- Define a parallel list of **state names** — one per trigger, in the same order.
- When any trigger fires, the blueprint looks up the firing entity in the trigger list and selects the matching state name on the target `input_select`.
- Duplicate state names produce **OR-override** behavior: whichever associated trigger fires first wins.
## Index Mapping
The two lists are matched by position:
| Index | Trigger entity | State name |
|-------|---------------|------------|
| 0 | `sensor.sun_next_rising` | `Утро` |
| 1 | `input_datetime.dnevnoe_vremia` | `День` |
| 2 | `sensor.sun_next_dusk` | `Вечер` |
| 3 | `input_datetime.vechernee_vremia_prinuditelno` | `Вечер` |
| 4 | `sensor.sun_next_midnight` | `Ночь` |
| 5 | `input_datetime.polnochnoe_vremia_prinuditelno` | `Ночь` |
In this example, `Вечер` is set when either the natural dusk time or the forced datetime fires — whichever comes first.
## Supported Time Sources
- `input_datetime` entities (time-only: `HH:MM:SS`).
- Timestamp sensors that report an ISO datetime (e.g. `sensor.sun_next_rising`).
## Configuration
| Input | Description |
|-------|-------------|
| **Time of Day Selector** | The `input_select` entity to update. Its options must include every state name in the list below. |
| **Time of Day Triggers** | Ordered list of trigger entities. |
| **Time of Day States** | Parallel list of state names, same length as triggers. |
| **Debug mode** | When enabled, posts a persistent notification on each fire with the firing entity, resolved state, and previous state. |
## Behavioral Notes
- `input_select.select_option` is idempotent — repeated triggers for the same state cause no extra state changes.
- A guard condition skips the action if the resolved state already matches the current `input_select` value.
- On Home Assistant restart, the state is **not** retroactively corrected — it updates on the next trigger. If you need self-correcting state on restart, use the [Time Of Day Controller](../Time%20Of%20Day%20Controller/README.md) (polling) blueprint instead.
## Author
Alexei Dolgolyov (dolgolyov.alexei@gmail.com)