Loading...
Loading...
Best practices for Home Assistant automations, helpers, scripts, and device controls. TRIGGER THIS SKILL WHEN: - Creating or editing HA automations, scripts, or scenes - Choosing between template sensors and built-in helpers - Writing or restructuring triggers, conditions, or automation modes - Setting up Zigbee button/remote automations (ZHA or Zigbee2MQTT) - Renaming entities or migrating device_id references to entity_id SYMPTOMS THAT TRIGGER THIS SKILL: - Agent uses Jinja2 templates where native conditions, triggers, or helpers exist - Agent uses device_id instead of entity_id in triggers/actions - Agent modifies entity IDs or config objects without checking all consumers - Agent chooses wrong automation mode (e.g., single for motion lights)
npx skill4agent add homeassistant-ai/skills home-assistant-best-practicesreferences/safe-refactoring.mdreferences/automation-patterns.md{{ states('x') | float > 25 }}numeric_stateabove: 25{{ is_state('x', 'on') and is_state('y', 'on') }}condition: and{{ now().hour >= 9 }}condition: timeafter: "09:00:00"wait_template: "{{ is_state(...) }}"wait_for_triggerreferences/safe-refactoring.md#trigger-restructuringreferences/helper-selection.mdmin_maxgroupderivativethresholdutility_metersinglereferences/automation-patterns.md#automation-modes| Scenario | Mode |
|---|---|
| Motion light with timeout | |
| Sequential processing (door locks) | |
| Independent per-entity actions | |
| One-shot notifications | |
device_idreferences/device-control.mdeventdevice_ieeedevicemqttreferences/device-control.md#zigbee-buttonremote-patterns| Anti-pattern | Use instead | Why | Reference |
|---|---|---|---|
| | Validated at load, not runtime | |
| | Event-driven, not polling; waits for change (see | |
| | device_id breaks on re-add | |
| | Re-triggers must reset the timer | |
| Template sensor for sum/mean | | Declarative, handles unavailable states | |
| Template binary sensor with threshold | | Built-in hysteresis support | |
| Renaming entity IDs without impact analysis | Follow | Renames break dashboards, scripts, and scenes silently | |
| File | When to read | Key sections |
|---|---|---|
| Renaming entities, replacing helpers, restructuring automations, or any modification to existing config | |
| Writing triggers, conditions, waits, or choosing automation modes | |
| Deciding whether to use a built-in helper vs template sensor | |
| Confirming templates ARE appropriate for a use case | |
| Writing service calls, Zigbee button automations, or using target: | |
| Need compound examples combining multiple best practices | — |