Skip to content

xxczaki/homeassistant

Repository files navigation

xxczaki/homeassistant

Tests Validate HA Config

🏠 My personal smart home setup, powered by Home Assistant

Presence-based lighting

The flat runs a small state machine that tracks input_select.current_room and turns lights off only on real transitions, never on a single "no motion" reading. A master kill switch (input_boolean.presence_enabled) can disable the whole model, e.g., when guests are over.

The full rule set, scenario matrix, and tuning knobs live in docs/presence-model.md. It's the source of truth – every row of the matrix has a matching test in tests/.

Test suite

In-process pytest suite that loads the real automations.yaml and packages/presence.yaml into a Home Assistant test instance, drives fake state changes through HA's actual automation engine, advances virtual time without real sleeps, and asserts the resulting entity states.

$ cd tests
$ uv sync                   # install the dev group into a virtualenv
$ uv run pytest             # run the suite
$ uv run pytest -k motion   # run a single test by keyword

mise will install Python and uv on first entry into the repo if they aren't already present.

To add a new test: add the scenario to the matrix in docs/presence-model.md if it isn't there, write a test that drives the events and asserts the expected end state using the helpers in tests/helpers.py, and reference the matrix row in the test's docstring so the doc and the suite stay paired.

AI disclosure

This project contains code generated by Large Language Models (LLMs), under human supervision and proofreading.

License

MIT

About

My personal home automation setup, powered by Home Assistant 🏠

Topics

Resources

License

Stars

Watchers

Forks

Contributors