Hello again ![]()
Today is the time for my third custom HACS integration from the “Entity” family: Entity Guard
## What is it?
**Entity Guard** enforces the state you *want* your Home Assistant devices to stay in.
Instead of writing a separate automation for every “turn this back off,” “lock this again,” or “kill this switch” rule, you create one simple rule per device and Entity Guard keeps it in line.
Think of the little jobs you keep re-writing as automations:
- *The front door should re-lock itself 10 seconds after it’s unlocked.*
- *The kids’ TV should switch off once curfew starts.*
- *That diffuser should shut down the moment the water runs low.*
- *The bedroom lights should never go brighter than half at night.*
Each of those becomes one rule. Entity Guard watches the device/entity, and whenever it drifts out of line, it quietly puts it back, with built-in protection so it never gets stuck in a loop fighting your other automations.
## The highlights
**Simple rules, one per job**
You pick a device/entity (or several), a trigger, and the state it should be forced into. Entity Guard does the rest. One rule replaces a hand-written auto-off, auto-lock, or kill-switch automation.
**Force a state**
The most common mode. When a device enters one of the states you choose, Entity Guard forces it into your target state, with an optional delay before it acts.
**Clamp a value or match a color**
Instead of a full on/off state, a rule can keep a number in check (brightness, volume, temperature, or a percentage, etc.) and pull it back whenever it crosses your threshold. It can also hold a light to a specific colour or warmth (a set RGB colour or a colour temperature in Kelvin). Lights that are off or unavailable are left alone
Entity Guard won’t switch a light on just to correct its colour.
**Extra conditions**
Only want a rule to fire when nobody’s home, or after sunset? Add condition flags. The rule then acts only when *all* of them match. If a flag device goes missing, the rule safely holds off rather than misfiring.
**Loop protection**
If a rule ever starts firing too often, Entity Guard notices and automatically pauses that rule for a while so nothing thrashes. You can raise, lower, or turn off the limit per rule.
**Debounce**
Ignore quick back-and-forth flapping. The rule only acts once a change settles for the window you set.
**Safety seatbelt**
Rules that physically move things, doors, locks, blinds, thermostats, require you to tick a safety acknowledgement before they can be saved. A deliberate pause-and-confirm.
**Pause without deleting**
Need a break during maintenance? Suppress a rule for anything from a minute up to a full day and it resumes on its own. There’s also a panic stop that disables every rule at once and flips the global master switch off.
**Master switch**
One global kill-switch across every rule. Flip it off and Entity Guard stands down entirely.
## The card
Entity Guard comes with a custom dashboard card, and it registers itself automatically after installation. No manual setup.
Each card shows a rule’s name and a colour-coded status badge (watching, enforcing, paused, in cooldown, and so on), how many times it has enforced today and in total, when it last acted, and the list of devices it’s watching.
You can optionally show the condition flags and a row of action buttons: test, reset, clear history, and a quick one-hour pause.
## Automation examples on the repo
If you find this useful, I’ve built a few other custom integrations too:
- Entity Distance: Tracks distance between 2–5 people, devices, or zones, including direction, speed, ETA, and proximity.
- Entity Availability: Know when your devices go offline, and how reliable they really are.
- Entity State Tracker: Tracks how long devices spend in each state over time, with per-state breakdowns, scoring, and a custom card.
- Fuel Compare: Tracks live fuel prices from 36 providers across 30 countries.
- WashWise: Helps you decide whether to wash your car, bike, or solar panels, and whether to run garden irrigation, based on the weather forecast.
- DashSnap: Home Assistant App to record or screenshot any web page via headless Chromium: HA dashboards, Grafana, public pages.
- DashSnap Integration: Trigger DashSnap from Home Assistant automations. See App above.
Happy to answer questions here. Bug reports and feature requests are welcome on GitHub Issues too.



