Files
claude-sync/projects/-Users-csader/memory/reference_ha_automation_patterns.md
T
Chris 33cab10cef Initial sync: memory, agents, commands, and gitignore
Syncs project memory, custom agents, and commands across machines.
Excludes secrets (settings.json), session state, and runtime files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-11 09:19:24 -05:00

2.4 KiB

name, description, type
name description type
HA automation management patterns How to create/update HA automations via REST/WS API, scene save/restore, categories, and established patterns reference

Automation configs are updated via POST (not PUT): POST http://192.168.86.36:8123/api/config/automation/config/<numeric_id>

Key patterns established:

  • Notifications: notify.mobile_app_pixel_10_pro_fold with "image" for snapshots and "clickAction" for deep links
  • TTS: tts.speak targeting tts.home_assistant_cloud with media_player_entity_id (not deprecated tts.google_translate_say)
  • Sun azimuth: sun.sun attribute azimuth for directional triggers (west door = 225-315°, east windows = 45-135°). East shades have NO temp condition; front door shade still requires >80°F.
  • Weather conditions: sensor.openweathermap_condition states: sunny, clear-night, partlycloudy, cloudy, rainy, pouring, snowy, fog, lightning, lightning-rainy
  • Scene save/restore: scene.create with snapshot_entities to save state, scene.turn_on to restore. Used for Theater Mode and Climate thermostat save/restore.
  • Enabling/disabling automations: WebSocket API config/entity_registry/update with disabled_by: null to enable, disabled_by: user to disable
  • Categories: WebSocket config/category_registry/create (scope: automation) and config/entity_registry/update with categories: {automation: cat_id}

Automation categories (scope: automation):

  • Sprinklers, Shades & Blinds, Cameras & Security, Home Theater, Lights, 3D Printers, Garage, Fans, Climate, Routines, Severe Weather

Gotchas:

  • Don't trigger Theater Mode on TV power — TV turns on for non-movie use. Only trigger via input_boolean.theater_mode toggle.
  • Battery-powered Zigbee devices (locks) sleep aggressively — service calls that need a response (code queries) will timeout. Lock/unlock works because Z2M queues commands.
  • Always use backup: true when calling update.install on add-ons.
  • Wind gust entity is sensor.openweathermap_wind_gust (NOT _wind_gust_speed).
  • weather.get_forecasts requires ?return_response when called via REST API. Response is at d['service_response']['weather.openweathermap']['forecast'].
  • Template references to NWS alerts must handle empty alerts list: use | first | default({}) pattern, not [0].

How to apply: Reference these patterns when creating or modifying HA automations.