Home Assistant automations are made of three parts: a trigger (something happens), optional conditions (only if…), and actions (do this). Compose rules below, press Run day, and watch this little house live through 24 simulated hours — motion, doors, sunset, temperature — with your automations firing in real time.
light.living_room, binary_sensor.front_door, climate.house. Everything you automate is an entity with a state.sun below horizon condition doesn't blind you at noon.Home Assistant configuration is YAML. Editing it live over SSH works until a typo breaks reload at 11pm. Treating it as code — in git, edited by tools (like a Claude Code skill driving hass-cli or MCP) — gives you diffs, review, rollback, and reproducible dashboards:
automation:
- alias: "Evening motion light"
trigger:
- platform: state
entity_id: binary_sensor.living_motion
to: "on"
condition:
- condition: sun
after: sunset
action:
- service: light.turn_on
target: {entity_id: light.living_room}
Every rule you build above maps 1:1 onto this structure — that is the whole mental model.