Skip to content

About

Rule-based controller for blinds, shutters and venetian covers in Home Assistant: sun shading by facade, tilt/slat control, night and heat modes, manual override, explainable decisions

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Cover Logic — one decision for every blind in your house

HACS custom Release Tests Home Assistant 2026.8+ MIT license Docs

Stop chasing "why did that blind just close?"
Describe your blinds, the modes your house can be in and the rules for each —
one engine decides where every blind should be, and tells you which rule decided it.


How it decides

flowchart LR
    A["🏠 House state<br/>sensors · helpers · sun"] --> B["🌗 Mode<br/>first match wins"]
    B --> C["📋 Zone rules<br/>first match wins"]
    C --> D["🛡️ Guards<br/>skip · defer · force"]
    D --> E["⚙️ Planner<br/>position, then tilt"]
    E --> F["🪟 cover.* services"]
Loading

Every step is visible afterwards on sensor.cover_logic_mode — the active mode, the rule each blind got, what is waiting on a guard, and the last command sent.

Why Cover Logic

🧭 One decision

Modes and first-match rules replace a pile of automations that disagree about the same window.

🔍 A trace for every move

Each blind names the exact rule that set it, so "why?" has an answer.

🧪 Shadow mode first

dry_run is on by default: it decides and logs, and moves nothing until you say so.

🛡️ Interlocks

Guards skip, defer or force a blind — never lower it onto an open terrace door.

☀️ Sun geometry

Facade azimuth and tolerance decide when the sun hits a window; slat angle can be computed.

✋ Respects people

A manual move from the app is held until the decided target changes.

Quick start

  1. HACS → ⋮ → Custom repositories → https://github.com/PeterLinuxOSS/ha-cover-logic, category Integration, then download Cover Logic.
  2. Restart Home Assistant.
  3. Settings → Devices & Services → Add Integration → Cover Logic → Set up blinds now: pick your covers, say which way each window faces, done.

It starts in shadow mode — watch what it would do, then turn dry_run off. Without HACS, copy custom_components/cover_logic/ into your custom_components/ and restart.

Read the docs

Compared with

Cover Logic adaptive-cover Hand-written automations
Scope A whole house, zones and modes in one entry One instance per window or group One automation per idea
Decision First-match rules, YAML or UI Fixed sun-position algorithm Whatever you wrote
Interlocks (doors, wind, sauna) Built in (guards:) None built in Up to you
Dry run Shadow mode by default None documented No
"Why did it move?" Trace names the rule No decision trace Read the traces of each automation
Setting up one window More to configure Simplest Simple

adaptive-cover is the better fit for shading one window out of the box; Cover Logic is built for deciding every cover in the house from one set of rules.

For developers

MODELS.md is the technical brief and docs/rationale.md the design-decision ledger. docs/example-config.yaml is a complete example; fixtures/dom_peter.yaml is the author's real house and the migration fixture — do not copy from it.

python3 -m pytest tests/ -q              # decision core, any Python >= 3.12
.venv/bin/python -m pytest tests/ -q     # + Home Assistant layer, Python >= 3.14.2
ruff check . && ruff format --check .

tests/parity/ compares the engine with a real house's Jinja template across 92,160 scenarios; those files are not in this repository, so it cannot run in CI — run it locally before trusting a change to the decision logic. MODELS.md §8 explains what each interpreter exercises.

License

MIT — see LICENSE.

About

Rule-based controller for blinds, shutters and venetian covers in Home Assistant: sun shading by facade, tilt/slat control, night and heat modes, manual override, explainable decisions

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages