Home Assistant - Complete Setup & Automation Guide Cheat Sheet

Last Updated: November 21, 2025

Installation Methods

Method Best For
Home Assistant OS Recommended - Full featured, easy updates, add-on support (Raspberry Pi, NUC)
Home Assistant Container Docker users - no add-ons, manual management
Home Assistant Supervised Advanced - add-on support on existing Linux system
Home Assistant Core Developers - Python virtual environment, manual everything
Pre-built appliance Plug-and-play - Home Assistant Yellow, Blue, ODROID

Hardware Requirements

Component Recommendation
Raspberry Pi Pi 4 (4GB+ RAM) or Pi 5 - most popular choice
Storage 32GB+ SSD (not SD card - reliability issues)
Power supply Official Pi power supply (3A for Pi 4)
Network Ethernet recommended (more stable than WiFi)
USB Stick (optional) Zigbee/Z-Wave coordinator (Conbee II, Sonoff, Zooz)
Alternative hardware Intel NUC, old laptop, VM (more power for complex setups)

Top 20 Integrations

Integration Purpose
Zigbee (ZHA or Zigbee2MQTT) Control Zigbee devices (sensors, lights, switches)
Z-Wave JS Z-Wave devices (locks, sensors, switches)
ESPHome DIY sensors/devices with ESP8266/ESP32 boards
MQTT Message broker for IoT devices
Philips Hue Hue lights and accessories
Google Home/Assistant Voice control, cast to displays
Amazon Alexa Voice control through Alexa devices
Apple HomeKit Expose HA devices to Apple Home app
HACS Community store for custom integrations/themes
Node-RED Visual automation builder (more powerful than GUI)
Frigate NVR with AI object detection for security cameras
AdGuard Home Network-wide ad blocking
Weather Met.no, OpenWeatherMap, AccuWeather
Mobile App iOS/Android app for remote access, notifications, location tracking
Spotify Control Spotify playback
Sonos Control Sonos speakers
UniFi Network device tracking, presence detection
Tesla Monitor and control Tesla vehicles
Local Calendar Calendar integration for automation triggers
Sun Sunrise/sunset automation triggers (built-in)

Essential Add-ons

Add-on Purpose
File Editor Edit YAML files directly in browser
Studio Code Server Full VS Code editor in browser (better than File Editor)
Mosquitto MQTT Broker MQTT message broker for device communication
Zigbee2MQTT Alternative Zigbee coordinator (more device support than ZHA)
ESPHome Manage ESP-based devices
Node-RED Visual automation designer
Samba Share Access HA files over network (for backups)
SSH & Web Terminal Command-line access to HA OS
AdGuard Home DNS-based ad blocking
Grafana Advanced data visualization
InfluxDB Long-term data storage (for Grafana)
MariaDB Database for HA recorder (better than default SQLite)

Basic Automation Structure (YAML)

Section Example
Alias alias: "Turn on lights at sunset"
Trigger trigger:
- platform: sun
event: sunset
Condition condition:
- condition: state
entity_id: light.living_room
state: 'off'
Action action:
- service: light.turn_on
target:
entity_id: light.living_room
data:
brightness: 200
Mode mode: single # or restart, queued, parallel

Trigger Types

Trigger YAML Example
Time platform: time
at: "07:00:00"
State platform: state
entity_id: binary_sensor.motion
to: 'on'
Sun platform: sun
event: sunset
offset: "-00:30:00"
Numeric state platform: numeric_state
entity_id: sensor.temperature
above: 75
Zone platform: zone
entity_id: device_tracker.phone
zone: zone.home
event: enter
Template platform: template
value_template: "{{ states('sensor.temp') | float > 20 }}"
Webhook platform: webhook
webhook_id: "unique_webhook_id"
MQTT platform: mqtt
topic: "home/sensor1"

Condition Types

Condition YAML Example
State condition: state
entity_id: light.bedroom
state: 'off'
Numeric state condition: numeric_state
entity_id: sensor.temperature
below: 70
Time condition: time
after: "08:00:00"
before: "22:00:00"
Sun condition: sun
after: sunset
before: sunrise
Zone condition: zone
entity_id: device_tracker.phone
zone: zone.home
Template condition: template
value_template: "{{ states('sensor.temp') | float < 20 }}"
And/Or condition: and
conditions:
- condition: state
entity_id: light.bedroom
state: 'off'

Common Actions

Action YAML Example
Turn on light service: light.turn_on
target:
entity_id: light.living_room
data:
brightness: 255
color_temp: 300
Turn off device service: switch.turn_off
target:
entity_id: switch.coffee_maker
Notification service: notify.mobile_app
data:
message: "Motion detected!"
title: "Alert"
Set climate service: climate.set_temperature
target:
entity_id: climate.thermostat
data:
temperature: 72
Play media service: media_player.play_media
target:
entity_id: media_player.sonos
data:
media_content_type: music
media_content_id: "spotify:track:..."
Delay delay:
minutes: 5
Wait for trigger wait_for_trigger:
- platform: state
entity_id: binary_sensor.door
to: 'off'
timeout: "00:05:00"

Example Automations

Use Case Configuration
Motion light trigger: binary_sensor.motion → on
condition: sun → after sunset
action: light.turn_on (brightness 50%)
mode: restart
Good morning trigger: time → 07:00
condition: workday sensor → on
action: open blinds, turn on lights, start coffee
Arriving home trigger: device_tracker → zone.home (enter)
condition: sun → after sunset
action: turn on entry lights, unlock door, set temperature
Leaving home trigger: all device_trackers → zone.home (leave)
action: turn off all lights, lock doors, set away mode, arm alarm
Bedtime trigger: time → 22:00
action: dim bedroom lights to 10%, turn off living room, lock doors

Template Syntax

Purpose Example
Get state {{ states('sensor.temperature') }}
State as number {{ states('sensor.temperature') | float }}
If statement {% if states('light.bedroom') == 'on' %}Lights On{% endif %}
Math {{ (states('sensor.temp') | float * 1.8) + 32 }}
Time now {{ now().strftime('%H:%M') }}
Attribute {{ state_attr('climate.thermostat', 'current_temperature') }}
Filter entities {{ states.light | selectattr('state','eq','on') | list | count }}

Dashboard Cards (Lovelace)

Card Type Best For
Entity Card Single entity with controls (light, switch, sensor)
Entities Card Multiple entities in list format
Button Card Custom buttons for scenes, scripts
Thermostat Card Climate control interface
Media Control Card Control media players
Weather Card Weather forecast display
History Graph Card Historical sensor data visualization
Picture Elements Card Interactive floor plan overlay
Markdown Card Custom text, instructions, links
Conditional Card Show/hide cards based on conditions

Best Practices

Practice Why
Use packages Split configuration into logical files (lights.yaml, climate.yaml)
Regular backups Weekly automated backups to external storage
Use secrets.yaml Store passwords/API keys separately (never commit to Git)
Test automations Developer Tools → Services to test before deploying
Version control Use Git to track configuration changes
Naming conventions Consistent entity IDs (room_device format)
Use groups Logical grouping (all_lights, bedroom_devices)
MariaDB for recorder Better performance than SQLite for large datasets

Troubleshooting Commands

Task Command/Location
Check config Developer Tools → YAML → Check Configuration
Reload automations Developer Tools → YAML → Automations
View logs Settings → System → Logs
Restart HA Developer Tools → YAML → Restart
SSH into HA OS ssh root@homeassistant.local (install SSH add-on first)
Check entity state Developer Tools → States → Search entity
Test service Developer Tools → Services → Select service
💡 Pro Tips:
  • Start with Home Assistant OS on Raspberry Pi 4 - easiest path to success
  • Use SSD instead of SD card for reliability (boot from USB)
  • Install HACS early - gives access to thousands of community integrations
  • Create input_boolean helpers for manual automation overrides
  • Use Node-RED for complex automations - visual flow is easier than YAML
  • Set up remote access with Nabu Casa ($6.50/month) or DuckDNS (free)
  • Join Home Assistant community forum and Reddit for help and ideas
  • Use automation mode: restart for motion lights to prevent multiple timers
← Back to Data Science & ML | Browse all categories | View all cheat sheets