Home Assistant Installation Guide

Home Assistant is a free and open-source home automation platform that runs on Python. It puts local control and privacy first, serving as a FOSS alternative to proprietary smart home platforms like Google Home, Amazon Alexa, Apple HomeKit, or Samsung SmartThings.

Home automation🟡 intermediate41 min⏱️ 30-60 minutes

Home Assistant is a free and open-source home automation platform that runs on Python. It puts local control and privacy first, serving as a FOSS alternative to proprietary smart home platforms like Google Home, Amazon Alexa, Apple HomeKit, or Samsung SmartThings. Home Assistant supports over 2000 integrations and protocols for controlling smart home devices locally without requiring cloud connectivity.

FOSS Alternatives

Home Assistant is part of a rich ecosystem of free and open-source home automation solutions:

  • OpenHAB: Java-based home automation platform with extensive protocol support
  • Domoticz: Lightweight home automation system with web interface
  • ioBroker: Node.js-based automation platform with modular architecture
  • Node-RED: Visual programming tool for IoT and automation workflows
  • Hubitat Elevation: Local processing smart home hub (commercial but privacy-focused)
  • Jeedom: PHP-based home automation solution with plugin ecosystem
  • FHEM: Perl-based home automation server for controlling devices
  • 1. Prerequisites

    Hardware Requirements

  • CPU: Dual-core ARM or x86 processor (1.5+ GHz recommended)
  • RAM: 2 GB minimum (4 GB recommended for production)
  • Storage: 32 GB minimum (64 GB+ recommended)
  • Network: Ethernet or WiFi connectivity
  • USB Ports: For Z-Wave/Zigbee dongles (if using)
  • Operating System Requirements

  • RHEL 8/9, CentOS Stream 8/9, Rocky Linux 8/9, AlmaLinux 8/9, Fedora 37+
  • Debian 11/12, Ubuntu 20.04/22.04/24.04 LTS
  • Arch Linux (rolling), Manjaro
  • Alpine Linux 3.18+
  • openSUSE Leap 15.5+, Tumbleweed, SLES 15 SP5+
  • macOS 12+ (Monterey and later)
  • Network Requirements

  • HTTP: Port 8123 (default web interface)
  • HTTPS: Port 8123 with TLS (recommended)
  • mDNS: Port 5353 UDP (for device discovery)
  • MQTT: Port 1883/8883 (if using MQTT broker)
  • SSH: Port 22 (for remote management)
  • Dependencies

  • Python: 3.10 or later (3.11+ recommended)
  • pip: Python package manager
  • Git: For component updates
  • Build tools: For compiling native extensions
  • MQTT Broker: Mosquitto (optional but recommended)
  • Required System Access

  • Root/sudo: Required for installation and service setup
  • Dedicated user: homeassistant user account (created during setup)
  • Hardware access: USB devices for Z-Wave/Zigbee dongles
  • Domain/DNS Requirements (Optional)

  • Domain name for remote access
  • Dynamic DNS service (if using residential internet)
  • Valid SSL certificate (Let's Encrypt recommended)
  • 2. Installation

    RHEL/CentOS/Rocky Linux/AlmaLinux

    #### Method 1: Core Installation (Recommended)

    bash
    # Install EPEL repository for additional packages
    sudo dnf install -y epel-release
    
    # Install Python 3.11 and development tools
    sudo dnf install -y python3.11 python3.11-pip python3.11-devel python3.11-venv \
                        gcc gcc-c++ make git curl wget \
                        systemd-devel libffi-devel openssl-devel \
                        bluez-libs-devel
    
    # Create dedicated homeassistant user
    sudo useradd -r -s /bin/bash -d /opt/homeassistant homeassistant
    
    # Create installation directory
    sudo mkdir -p /opt/homeassistant
    sudo chown homeassistant:homeassistant /opt/homeassistant
    
    # Switch to homeassistant user
    sudo -u homeassistant -H -s
    
    # Create and activate virtual environment
    cd /opt/homeassistant
    python3.11 -m venv .
    source bin/activate
    
    # Upgrade pip and install wheel
    python -m pip install --upgrade pip wheel
    
    # Install Home Assistant
    python -m pip install homeassistant
    
    # Exit homeassistant user session
    exit

    #### Method 2: Supervised Installation

    bash
    # Install Docker (required for Supervised)
    sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
    sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
    
    # Start and enable Docker
    sudo systemctl enable --now docker
    
    # Install additional dependencies
    sudo dnf install -y curl jq apparmor-utils systemd-journal-remote
    
    # Download and install Home Assistant Supervised
    curl -Lo installer.sh https://github.com/home-assistant/supervised-installer/releases/latest/download/homeassistant-supervised.sh
    sudo bash installer.sh --machine qemux86-64

    Debian/Ubuntu

    #### Method 1: Core Installation (Recommended)

    bash
    # Update package list
    sudo apt update
    
    # Install Python 3.11 and development tools
    sudo apt install -y python3.11 python3.11-pip python3.11-dev python3.11-venv \
                        build-essential git curl wget \
                        libsystemd-dev libffi-dev libssl-dev \
                        bluetooth libbluetooth-dev
    
    # Create dedicated homeassistant user
    sudo useradd -r -s /bin/bash -d /opt/homeassistant homeassistant
    
    # Create installation directory
    sudo mkdir -p /opt/homeassistant
    sudo chown homeassistant:homeassistant /opt/homeassistant
    
    # Switch to homeassistant user
    sudo -u homeassistant -H -s
    
    # Create and activate virtual environment
    cd /opt/homeassistant
    python3.11 -m venv .
    source bin/activate
    
    # Upgrade pip and install wheel
    python -m pip install --upgrade pip wheel
    
    # Install Home Assistant
    python -m pip install homeassistant
    
    # Exit homeassistant user session
    exit

    #### Method 2: Supervised Installation

    bash
    # Install Docker
    sudo apt update
    sudo apt install -y ca-certificates curl gnupg lsb-release
    
    # Add Docker GPG key
    sudo mkdir -p /etc/apt/keyrings
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
    
    # Add Docker repository
    echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
      $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
    
    # Install Docker
    sudo apt update
    sudo apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
    
    # Install additional dependencies
    sudo apt install -y jq curl apparmor systemd-journal-remote
    
    # Download and install Home Assistant Supervised
    curl -Lo installer.sh https://github.com/home-assistant/supervised-installer/releases/latest/download/homeassistant-supervised.sh
    sudo bash installer.sh --machine qemux86-64

    Arch Linux

    bash
    # Update system
    sudo pacman -Syu
    
    # Install Python and development tools
    sudo pacman -S python python-pip python-virtualenv \
                   base-devel git curl wget \
                   systemd libffi openssl \
                   bluez-libs
    
    # Create dedicated homeassistant user
    sudo useradd -r -s /bin/bash -d /opt/homeassistant homeassistant
    
    # Create installation directory
    sudo mkdir -p /opt/homeassistant
    sudo chown homeassistant:homeassistant /opt/homeassistant
    
    # Switch to homeassistant user
    sudo -u homeassistant -H -s
    
    # Create and activate virtual environment
    cd /opt/homeassistant
    python -m venv .
    source bin/activate
    
    # Upgrade pip and install wheel
    python -m pip install --upgrade pip wheel
    
    # Install Home Assistant
    python -m pip install homeassistant
    
    # Exit homeassistant user session
    exit

    Alpine Linux

    bash
    # Update package index
    apk update
    
    # Install Python and development tools
    apk add --no-cache python3 py3-pip python3-dev \
                       build-base git curl wget \
                       systemd-dev libffi-dev openssl-dev \
                       bluez-dev linux-headers
    
    # Create dedicated homeassistant user
    adduser -D -s /bin/ash -h /opt/homeassistant homeassistant
    
    # Create installation directory
    mkdir -p /opt/homeassistant
    chown homeassistant:homeassistant /opt/homeassistant
    
    # Switch to homeassistant user
    su - homeassistant
    
    # Create and activate virtual environment
    cd /opt/homeassistant
    python3 -m venv .
    source bin/activate
    
    # Upgrade pip and install wheel
    python -m pip install --upgrade pip wheel
    
    # Install Home Assistant
    python -m pip install homeassistant
    
    # Exit homeassistant user session
    exit

    openSUSE/SLES

    bash
    # Install Python and development tools
    sudo zypper install -y python311 python311-pip python311-devel python311-virtualenv \
                            gcc gcc-c++ make git curl wget \
                            systemd-devel libffi-devel libopenssl-devel \
                            bluez-devel
    
    # Create dedicated homeassistant user
    sudo useradd -r -s /bin/bash -d /opt/homeassistant homeassistant
    
    # Create installation directory
    sudo mkdir -p /opt/homeassistant
    sudo chown homeassistant:homeassistant /opt/homeassistant
    
    # Switch to homeassistant user
    sudo -u homeassistant -H -s
    
    # Create and activate virtual environment
    cd /opt/homeassistant
    python3.11 -m venv .
    source bin/activate
    
    # Upgrade pip and install wheel
    python -m pip install --upgrade pip wheel
    
    # Install Home Assistant
    python -m pip install homeassistant
    
    # Exit homeassistant user session
    exit

    macOS

    bash
    # Install Homebrew if not already installed
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
    # Install Python 3.11
    brew install python@3.11
    
    # Create dedicated homeassistant user directory
    sudo mkdir -p /opt/homeassistant
    sudo chown $(whoami):staff /opt/homeassistant
    
    # Create and activate virtual environment
    cd /opt/homeassistant
    python3.11 -m venv .
    source bin/activate
    
    # Upgrade pip and install wheel
    python -m pip install --upgrade pip wheel
    
    # Install Home Assistant
    python -m pip install homeassistant

    3. Configuration

    Production Configuration Setup

    #### Complete Home Assistant Configuration

    yaml
    # Create comprehensive configuration
    sudo -u homeassistant tee /opt/homeassistant/.homeassistant/configuration.yaml << 'EOF'
    # Home Assistant Production Configuration
    homeassistant:
      # Basic information
      name: Smart Home
      latitude: !secret home_latitude
      longitude: !secret home_longitude
      elevation: !secret home_elevation
      unit_system: metric  # or imperial
      time_zone: America/New_York
      currency: USD
      country: US
    
      # Customization
      customize: !include customize.yaml
      packages: !include_dir_named packages
      allowlist_external_dirs:
        - /tmp
        - /backup
        - /config/www
    
      # Authentication providers
      auth_providers:
        - type: trusted_networks
          trusted_networks:
            - 192.168.1.0/24
            - 10.0.0.0/24
          allow_bypass_login: false
        - type: homeassistant
    
      # Security settings
      auth_mfa_modules:
        - type: totp
          name: "Authenticator App"
        - type: notify
          include:
            - notify.admin_devices
    
    # HTTP Configuration with Security
    http:
      server_host: 0.0.0.0
      server_port: 8123
      ssl_certificate: /opt/homeassistant/.homeassistant/certificates/fullchain.pem
      ssl_key: /opt/homeassistant/.homeassistant/certificates/privkey.pem
      trusted_proxies:
        - 127.0.0.1
        - 192.168.1.1
        - 10.0.0.1
      use_x_forwarded_for: true
      ip_ban_enabled: true
      login_attempts_threshold: 5
      cors_allowed_origins:
        - https://cast.home-assistant.io
    
    # Advanced Logging Configuration
    logger:
      default: warning
      logs:
        # Core components
        homeassistant.core: info
        homeassistant.setup: info
        homeassistant.config: info
        homeassistant.components.http: info
        homeassistant.components.websocket_api: info
        homeassistant.components.api: info
        homeassistant.auth: info
    
        # Automation and scripts
        homeassistant.components.automation: debug
        homeassistant.components.script: debug
        homeassistant.components.scene: debug
    
        # Integration specific
        homeassistant.components.mqtt: info
        homeassistant.components.zwave: info
        homeassistant.components.zigbee: info
        homeassistant.components.bluetooth: info
    
        # Suppress verbose logging
        homeassistant.helpers.entity: warning
        homeassistant.loader: warning
    
        # Custom components
        custom_components: debug
    
    # Database Configuration with Performance Optimization
    recorder:
      db_url: !secret db_url  # Use external database for production
      db_retry_wait: 10
      purge_keep_days: 30
      commit_interval: 5
      exclude:
        domains:
          - automation
          - updater
          - camera
          - media_player
          - group
          - scene
        entity_globs:
          - sensor.weather_*
          - sensor.*_battery_level
          - sensor.*_link_quality
        entities:
          - sun.sun
          - sensor.date
          - sensor.time
        event_types:
          - call_service
          - component_loaded
          - platform_discovered
          - service_registered
      include:
        domains:
          - switch
          - light
          - binary_sensor
          - climate
          - cover
          - lock
        entities:
          - sensor.temperature_*
          - sensor.humidity_*
          - sensor.power_*
    
    # History Configuration
    history:
      use_include_order: true
      exclude:
        domains:
          - automation
          - updater
          - camera
      include:
        domains:
          - sensor
          - switch
          - light
          - binary_sensor
    
    # InfluxDB for Long-term Statistics
    influxdb:
      host: !secret influxdb_host
      port: 8086
      database: homeassistant
      username: !secret influxdb_username
      password: !secret influxdb_password
      ssl: true
      verify_ssl: true
      max_retries: 3
      default_measurement: state
      exclude:
        domains:
          - automation
          - group
      include:
        domains:
          - sensor
          - binary_sensor
          - switch
      component_config_glob:
        sensor.*temperature*:
          override_measurement: temperature
        sensor.*humidity*:
          override_measurement: humidity
    
    # System Health Monitoring
    system_health:
    
    system_log:
      max_entries: 50
    
    # Frontend Configuration
    frontend:
      themes: !include_dir_merge_named themes
      extra_module_url:
        - /local/custom-cards.js
    
    lovelace:
      mode: storage
      dashboards:
        admin-dashboard:
          mode: yaml
          title: Admin
          icon: mdi:shield
          show_in_sidebar: true
          filename: dashboards/admin.yaml
          require_admin: true
    
    # Mobile App Support
    mobile_app:
    
    default_config:
    
    # Cloud Integration (optional)
    # cloud:
    #   alexa:
    #     filter:
    #       include_entities:
    #         - light.living_room
    #         - switch.bedroom
    #   google_actions:
    #     filter:
    #       include_domains:
    #         - light
    #         - switch
    
    # MQTT Configuration
    mqtt:
      broker: !secret mqtt_broker
      port: 8883
      username: !secret mqtt_username
      password: !secret mqtt_password
      certificate: /opt/homeassistant/.homeassistant/certificates/ca.crt
      tls_insecure: false
      protocol: 3.1.1
      keepalive: 60
      discovery: true
      discovery_prefix: homeassistant
      birth_message:
        topic: 'homeassistant/status'
        payload: 'online'
        qos: 1
        retain: true
      will_message:
        topic: 'homeassistant/status'
        payload: 'offline'
        qos: 1
        retain: true
    
    # Z-Wave Configuration
    zwave:
      usb_path: /dev/ttyUSB0
      network_key: !secret zwave_network_key
      config_path: /opt/homeassistant/.homeassistant/zwcfg/
      polling_interval: 60000
      device_config: !include zwave_device_config.yaml
    
    # Zigbee Configuration
    zha:
      usb_path: /dev/ttyUSB1
      database_path: /opt/homeassistant/.homeassistant/zigbee.db
      enable_quirks: true
      custom_quirks_path: /opt/homeassistant/.homeassistant/custom_zha_quirks/
    
    # Notification Configuration
    notify:
      - platform: smtp
        name: email_admin
        server: !secret smtp_server
        port: 587
        encryption: starttls
        username: !secret smtp_username
        password: !secret smtp_password
        sender: !secret smtp_sender
        recipient: !secret admin_email
    
      - platform: pushbullet
        name: pushbullet_admin
        api_key: !secret pushbullet_api_key
    
    # Backup Configuration
    backup:
      auto_purge: true
      password: !secret backup_password
    
    # Prometheus Metrics Export
    prometheus:
      namespace: hass
      component_config_glob:
        sensor.*temperature*:
          override_metric: temperature_celsius
        sensor.*humidity*:
          override_metric: humidity_percent
      filter:
        include_domains:
          - sensor
          - binary_sensor
          - switch
          - light
    
    # Stream Configuration
    stream:
      ll_hls: true
      part_duration: 0.75
      segment_duration: 6
    
    # Media Configuration
    media_source:
    media_extractor:
    
    # Text-to-Speech
    tts:
      - platform: google_translate
        cache: true
        cache_dir: /tmp/tts
        time_memory: 57600
        service_name: google_say
    
    # Weather
    weather:
      - platform: openweathermap
        api_key: !secret openweather_api_key
    
    # Device Tracking
    device_tracker:
      - platform: nmap_tracker
        hosts:
          - 192.168.1.0/24
        home_interval: 10
        consider_home: 180
        interval_seconds: 30
        track_new_devices: true
    
    # Scenes
    scene: !include scenes.yaml
    
    # Groups
    group: !include groups.yaml
    
    # Automations
    automation: !include automations.yaml
    
    # Scripts
    script: !include scripts.yaml
    
    # Zones
    zone: !include zones.yaml
    
    # Sensors
    sensor: !include_dir_merge_list sensors/
    
    # Binary Sensors
    binary_sensor: !include_dir_merge_list binary_sensors/
    
    # Switches
    switch: !include_dir_merge_list switches/
    
    # Lights
    light: !include_dir_merge_list lights/
    
    # Input Boolean/Number/Select/Text/Datetime
    input_boolean: !include input_boolean.yaml
    input_number: !include input_number.yaml
    input_select: !include input_select.yaml
    input_text: !include input_text.yaml
    input_datetime: !include input_datetime.yaml
    
    # Timers and Counters
    timer: !include timers.yaml
    counter: !include counters.yaml
    
    # Utility Meter
    utility_meter: !include utility_meter.yaml
    
    # REST Commands
    rest_command: !include rest_commands.yaml
    
    # Shell Commands
    shell_command: !include shell_commands.yaml
    
    # Panel Configuration
    panel_iframe:
      configurator:
        title: Configurator
        icon: mdi:wrench
        url: https://homeassistant.local:3218
        require_admin: true
    
      grafana:
        title: Grafana
        icon: mdi:chart-timeline
        url: https://grafana.local:3000
        require_admin: false
    EOF

    #### Secrets Configuration

    yaml
    # Create secrets file with sensitive information
    sudo -u homeassistant tee /opt/homeassistant/.homeassistant/secrets.yaml << 'EOF'
    # Location secrets
    home_latitude: 40.7128
    home_longitude: -74.0060
    home_elevation: 10
    
    # Database
    db_url: postgresql://homeassistant:HA_DB_Pass_2024!@localhost/homeassistant
    
    # InfluxDB
    influxdb_host: localhost
    influxdb_username: homeassistant
    influxdb_password: InfluxDB_Pass_2024!
    
    # MQTT
    mqtt_broker: localhost
    mqtt_username: homeassistant
    mqtt_password: MQTT_Pass_2024!
    
    # Z-Wave
    zwave_network_key: "0x2e, 0xcc, 0xab, 0x1c, 0xa3, 0x7f, 0x0e, 0xb5, 0x70, 0x71, 0x2d, 0x98, 0x25, 0x43, 0xee, 0x0c"
    
    # Email
    smtp_server: smtp.gmail.com
    smtp_username: your_email@gmail.com
    smtp_password: App_Specific_Password
    smtp_sender: your_email@gmail.com
    admin_email: admin@example.com
    
    # API Keys
    openweather_api_key: your_openweather_api_key
    pushbullet_api_key: your_pushbullet_api_key
    
    # Backup
    backup_password: Backup_Encryption_Pass_2024!
    EOF
    
    # Set proper permissions
    sudo chmod 600 /opt/homeassistant/.homeassistant/secrets.yaml
    sudo chown homeassistant:homeassistant /opt/homeassistant/.homeassistant/secrets.yaml

    #### Advanced Security Configuration

    yaml
    # Create advanced security configuration
    sudo -u homeassistant tee /opt/homeassistant/.homeassistant/packages/security.yaml << 'EOF'
    # Security Package Configuration
    
    # Failed Login Notification
    automation:
      - alias: "Security: Notify Failed Login Attempts"
        trigger:
          - platform: state
            entity_id: persistent_notification.http_login
        condition:
          - condition: template
            value_template: "{{ 'invalid authentication' in trigger.to_state.state|lower }}"
        action:
          - service: notify.email_admin
            data:
              title: "Security Alert: Failed Login Attempt"
              message: |
                Failed login attempt detected:
                {{ trigger.to_state.attributes.message }}
                Time: {{ now() }}
          - service: persistent_notification.create
            data:
              title: "Security Alert"
              message: "Failed login attempt detected. Check logs for details."
              notification_id: security_alert
    
      - alias: "Security: Lock Down After Multiple Failed Attempts"
        trigger:
          - platform: template
            value_template: "{{ states('sensor.failed_login_attempts')|int > 10 }}"
        action:
          - service: homeassistant.turn_on
            entity_id: input_boolean.lockdown_mode
          - service: notify.pushbullet_admin
            data:
              title: "CRITICAL: System Lockdown"
              message: "More than 10 failed login attempts. System entering lockdown mode."
    
      - alias: "Security: Daily Security Report"
        trigger:
          - platform: time
            at: "23:00:00"
        action:
          - service: notify.email_admin
            data:
              title: "Daily Security Report"
              message: |
                Daily Security Summary:
                - Failed Login Attempts: {{ states('sensor.failed_login_attempts') }}
                - Successful Logins: {{ states('sensor.successful_logins') }}
                - New Devices: {{ states('sensor.new_devices_today') }}
                - System Uptime: {{ states('sensor.uptime') }}
                - SSL Certificate Expiry: {{ states('sensor.ssl_cert_expiry') }} days
    
    # Security Sensors
    sensor:
      - platform: command_line
        name: SSL Certificate Expiry
        unit_of_measurement: days
        scan_interval: 86400
        command: "echo $(( ($(date -d \"$(openssl x509 -in /opt/homeassistant/.homeassistant/certificates/fullchain.pem -noout -enddate | cut -d= -f2)\" +%s) - $(date +%s)) / 86400 ))"
    
      - platform: file
        name: Failed Login Attempts
        file_path: /opt/homeassistant/.homeassistant/home-assistant.log
        value_template: "{{ value.count('Login attempt') }}"
    
      - platform: uptime
        name: System Uptime
    
      - platform: systemmonitor
        resources:
          - type: disk_use_percent
            arg: /
          - type: memory_use_percent
          - type: processor_use
          - type: load_1m
          - type: load_5m
          - type: load_15m
    
    # Security Input Booleans
    input_boolean:
      lockdown_mode:
        name: Lockdown Mode
        initial: off
        icon: mdi:shield-lock
    
      vacation_mode:
        name: Vacation Mode
        initial: off
        icon: mdi:beach
    
      guest_mode:
        name: Guest Mode
        initial: off
        icon: mdi:account-multiple
    
    # Security Scripts
    script:
      emergency_lockdown:
        alias: "Emergency Lockdown"
        sequence:
          - service: input_boolean.turn_on
            entity_id: input_boolean.lockdown_mode
          - service: lock.lock
            entity_id: all
          - service: alarm_control_panel.alarm_arm_away
            entity_id: alarm_control_panel.home_alarm
          - service: notify.all
            data:
              title: "EMERGENCY LOCKDOWN ACTIVATED"
              message: "All locks secured. Alarm armed. Notifications sent."
    
      security_check:
        alias: "Security Check"
        sequence:
          - service: script.check_all_locks
          - service: script.check_all_windows
          - service: script.check_cameras
          - service: notify.email_admin
            data:
              title: "Security Check Complete"
              message: "All security systems checked and verified."
    
    # Binary Sensors for Security
    binary_sensor:
      - platform: template
        sensors:
          security_status:
            friendly_name: "Security Status"
            device_class: safety
            value_template: |
              {{ is_state('input_boolean.lockdown_mode', 'off')
                 and is_state('binary_sensor.all_doors', 'off')
                 and is_state('binary_sensor.all_windows', 'off') }}
    
          all_doors:
            friendly_name: "All Doors"
            device_class: door
            value_template: "{{ is_state('group.all_doors', 'on') }}"
    
          all_windows:
            friendly_name: "All Windows"
            device_class: window
            value_template: "{{ is_state('group.all_windows', 'on') }}"
    EOF

    #### Nginx Reverse Proxy Configuration

    bash
    # Create Nginx configuration for Home Assistant
    sudo tee /etc/nginx/sites-available/homeassistant << 'EOF'
    map $http_upgrade $connection_upgrade {
        default upgrade;
        ''      close;
    }
    
    # Rate limiting
    limit_req_zone $binary_remote_addr zone=ha_limit:10m rate=10r/s;
    
    server {
        listen 80;
        listen [::]:80;
        server_name homeassistant.example.com;
        return 301 https://$server_name$request_uri;
    }
    
    server {
        listen 443 ssl http2;
        listen [::]:443 ssl http2;
        server_name homeassistant.example.com;
    
        # SSL Configuration
        ssl_certificate /etc/letsencrypt/live/homeassistant.example.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/homeassistant.example.com/privkey.pem;
        ssl_protocols TLSv1.2 TLSv1.3;
        ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384;
        ssl_prefer_server_ciphers off;
        ssl_session_cache shared:SSL:10m;
        ssl_session_timeout 10m;
        ssl_stapling on;
        ssl_stapling_verify on;
    
        # Security headers
        add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
        add_header X-Content-Type-Options nosniff;
        add_header X-Frame-Options SAMEORIGIN;
        add_header X-XSS-Protection "1; mode=block";
        add_header Referrer-Policy "strict-origin-when-cross-origin";
    
        # Rate limiting
        limit_req zone=ha_limit burst=20 nodelay;
    
        # Proxy settings
        proxy_buffering off;
    
        location / {
            proxy_pass http://127.0.0.1:8123;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection $connection_upgrade;
        }
    
        location /api/websocket {
            proxy_pass http://127.0.0.1:8123/api/websocket;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection $connection_upgrade;
        }
    
        # Media files
        location /media {
            proxy_pass http://127.0.0.1:8123;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_max_temp_file_size 0;
            client_max_body_size 100M;
        }
    }
    EOF
    
    sudo ln -s /etc/nginx/sites-available/homeassistant /etc/nginx/sites-enabled/
    sudo nginx -t && sudo systemctl reload nginx

    #### Database Optimization

    bash
    # Create PostgreSQL database for better performance
    sudo -u postgres psql << EOF
    CREATE USER homeassistant WITH PASSWORD 'HA_DB_Pass_2024!';
    CREATE DATABASE homeassistant OWNER homeassistant;
    GRANT ALL PRIVILEGES ON DATABASE homeassistant TO homeassistant;
    EOF
    
    # Create database maintenance script
    sudo tee /opt/homeassistant/db-maintenance.sh << 'EOF'
    #!/bin/bash
    # Home Assistant Database Maintenance Script
    
    # Vacuum and analyze PostgreSQL database
    psql -U homeassistant -d homeassistant -c "VACUUM ANALYZE;"
    
    # Reindex database
    psql -U homeassistant -d homeassistant -c "REINDEX DATABASE homeassistant;"
    
    # Clean old statistics
    psql -U homeassistant -d homeassistant -c "DELETE FROM statistics WHERE created < NOW() - INTERVAL '90 days';"
    
    # Clean old events
    psql -U homeassistant -d homeassistant -c "DELETE FROM events WHERE time_fired < NOW() - INTERVAL '30 days';"
    
    echo "Database maintenance completed at $(date)"
    EOF
    
    sudo chmod +x /opt/homeassistant/db-maintenance.sh
    
    # Add to crontab for weekly maintenance
    (crontab -l 2>/dev/null; echo "0 3 * * 0 /opt/homeassistant/db-maintenance.sh >> /var/log/homeassistant/db-maintenance.log 2>&1") | crontab -

    Custom Components Configuration

    bash
    # Create directory structure for custom components
    sudo -u homeassistant mkdir -p /opt/homeassistant/.homeassistant/custom_components
    sudo -u homeassistant mkdir -p /opt/homeassistant/.homeassistant/www
    sudo -u homeassistant mkdir -p /opt/homeassistant/.homeassistant/packages
    sudo -u homeassistant mkdir -p /opt/homeassistant/.homeassistant/themes
    sudo -u homeassistant mkdir -p /opt/homeassistant/.homeassistant/dashboards
    sudo -u homeassistant mkdir -p /opt/homeassistant/.homeassistant/certificates
    
    # Set proper permissions
    sudo chmod -R 755 /opt/homeassistant/.homeassistant/
    sudo chmod 700 /opt/homeassistant/.homeassistant/certificates

    4. Service Management

    systemd (RHEL, Debian, Arch, SUSE)

    bash
    # Create systemd service file
    sudo tee /etc/systemd/system/homeassistant.service > /dev/null <<EOF
    [Unit]
    Description=Home Assistant
    After=network-online.target
    Wants=network-online.target
    
    [Service]
    Type=simple
    User=homeassistant
    Group=homeassistant
    WorkingDirectory=/opt/homeassistant
    ExecStart=/opt/homeassistant/bin/hass -c "/opt/homeassistant/.homeassistant"
    RestartForceExitStatus=100
    Restart=on-failure
    RestartSec=5s
    
    [Install]
    WantedBy=multi-user.target
    EOF
    
    # Reload systemd and enable service
    sudo systemctl daemon-reload
    sudo systemctl enable homeassistant.service
    
    # Service management commands
    sudo systemctl start homeassistant    # Start service
    sudo systemctl stop homeassistant     # Stop service
    sudo systemctl restart homeassistant  # Restart service
    sudo systemctl status homeassistant   # Check status
    sudo journalctl -u homeassistant -f   # View logs

    OpenRC (Alpine)

    bash
    # Create OpenRC service file
    sudo tee /etc/init.d/homeassistant > /dev/null <<'EOF'
    #!/sbin/openrc-run
    
    name="Home Assistant"
    description="Open source home automation"
    
    user="homeassistant"
    group="homeassistant"
    pidfile="/var/run/homeassistant.pid"
    command="/opt/homeassistant/bin/hass"
    command_args="-c /opt/homeassistant/.homeassistant --pid-file ${pidfile} --daemon"
    command_background="yes"
    
    depend() {
        need net
        after firewall
    }
    EOF
    
    # Make executable and enable
    sudo chmod +x /etc/init.d/homeassistant
    sudo rc-update add homeassistant
    
    # Service management commands
    sudo service homeassistant start    # Start service
    sudo service homeassistant stop     # Stop service
    sudo service homeassistant restart  # Restart service
    sudo service homeassistant status   # Check status

    launchd (macOS)

    bash
    # Create launchd plist file
    sudo tee /Library/LaunchDaemons/io.homeassistant.plist > /dev/null <<EOF
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>Label</key>
        <string>io.homeassistant</string>
        <key>ProgramArguments</key>
        <array>
            <string>/opt/homeassistant/bin/hass</string>
            <string>-c</string>
            <string>/opt/homeassistant/.homeassistant</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>KeepAlive</key>
        <true/>
        <key>StandardErrorPath</key>
        <string>/opt/homeassistant/homeassistant.log</string>
        <key>StandardOutPath</key>
        <string>/opt/homeassistant/homeassistant.log</string>
    </dict>
    </plist>
    EOF
    
    # Load and start service
    sudo launchctl load /Library/LaunchDaemons/io.homeassistant.plist
    sudo launchctl start io.homeassistant
    
    # Service management commands
    sudo launchctl start io.homeassistant   # Start service
    sudo launchctl stop io.homeassistant    # Stop service
    sudo launchctl unload /Library/LaunchDaemons/io.homeassistant.plist  # Disable

    Advanced Configuration

    #### Configuration File Syntax

    Home Assistant uses YAML for configuration. Key concepts:

    yaml
    # Basic syntax
    key: value
    key_with_list:
      - item1
      - item2
    key_with_dict:
      subkey: value
    
    # Including other files
    group: !include groups.yaml
    automation: !include_dir_list automations/
    script: !include_dir_named scripts/
    
    # Using secrets
    api_key: !secret weather_api_key

    #### Environment Variables

    bash
    # Set environment variables for Home Assistant
    export HASS_SERVER_HOST=0.0.0.0
    export HASS_SERVER_PORT=8123
    
    # Add to ~/.bashrc or systemd service file
    Environment=HASS_SERVER_HOST=0.0.0.0
    Environment=HASS_SERVER_PORT=8123

    #### Command-line Parameters

    bash
    # Common command-line options
    hass -c /path/to/config          # Specify config directory
    hass --script check_config       # Check configuration
    hass --script ensure_config      # Create default config
    hass --open-ui                   # Open web interface after start
    hass --debug                     # Enable debug logging
    hass --daemon                    # Run as daemon
    hass --pid-file /var/run/hass.pid # Specify PID file

    #### Integration with Other Services

    MQTT Integration:

    yaml
    # Add to configuration.yaml
    mqtt:
      broker: localhost
      port: 1883
      username: !secret mqtt_username
      password: !secret mqtt_password
      discovery: true
      discovery_prefix: homeassistant

    Zigbee Integration (zigbee2mqtt):

    yaml
    # Add to configuration.yaml
    mqtt:
      broker: localhost
      port: 1883
      discovery: true
      discovery_prefix: homeassistant
    
    # zigbee2mqtt will automatically create devices

    Z-Wave Integration:

    yaml
    # Add to configuration.yaml (for Z-Wave JS)
    zwave_js:
      url: "ws://localhost:3000"

    5. Troubleshooting

    Installation Issues

    Python version conflicts:

    bash
    # Check Python version
    python3 --version
    # Should be 3.10 or later
    
    # If wrong version, install correct Python
    sudo dnf install python3.11  # RHEL/CentOS
    sudo apt install python3.11  # Debian/Ubuntu

    Missing development packages:

    bash
    # Install missing development tools
    sudo dnf groupinstall "Development Tools"  # RHEL/CentOS
    sudo apt install build-essential  # Debian/Ubuntu

    Permission errors during pip install:

    bash
    # Ensure you're in the virtual environment
    source /opt/homeassistant/bin/activate
    # Check virtual environment is active
    which python
    # Should show: /opt/homeassistant/bin/python

    Service Issues

    Service fails to start:

    bash
    # Check service status
    sudo systemctl status homeassistant
    
    # Check logs
    sudo journalctl -u homeassistant -f
    
    # Common issues:
    # 1. Configuration errors
    # 2. Port already in use
    # 3. Permission problems

    Configuration validation:

    bash
    # Check configuration syntax
    sudo -u homeassistant -H -s
    cd /opt/homeassistant
    source bin/activate
    hass --script check_config -c .homeassistant

    Port conflicts:

    bash
    # Check what's using port 8123
    sudo netstat -tlnp | grep 8123
    sudo lsof -i :8123
    
    # Kill conflicting process or change port in configuration.yaml

    Permission Issues

    File permission issues:

    bash
    # Fix ownership
    sudo chown -R homeassistant:homeassistant /opt/homeassistant
    
    # Fix permissions
    sudo chmod -R 755 /opt/homeassistant
    sudo chmod -R 644 /opt/homeassistant/.homeassistant/*.yaml

    SELinux context issues (RHEL/CentOS):

    bash
    # Check SELinux status
    sestatus
    
    # Fix SELinux contexts
    sudo restorecon -Rv /opt/homeassistant
    sudo setsebool -P httpd_can_network_connect 1

    Network Issues

    Web interface not accessible:

    bash
    # Check if service is running
    sudo systemctl status homeassistant
    
    # Check listening ports
    sudo netstat -tlnp | grep python
    
    # Check firewall
    sudo firewall-cmd --list-all  # RHEL/CentOS
    sudo ufw status  # Ubuntu/Debian

    mDNS discovery not working:

    bash
    # Install and start Avahi
    sudo dnf install avahi avahi-tools  # RHEL/CentOS
    sudo apt install avahi-daemon avahi-utils  # Debian/Ubuntu
    sudo systemctl enable --now avahi-daemon
    
    # Test mDNS
    avahi-browse -r _http._tcp

    Debug Configuration

    bash
    # Enable debug logging
    # Edit configuration.yaml
    logger:
      default: debug
      logs:
        homeassistant.core: debug
        homeassistant.components: debug
    
    # Restart Home Assistant
    sudo systemctl restart homeassistant
    
    # Monitor logs
    sudo journalctl -u homeassistant -f

    Log Management

    bash
    # Common log locations
    tail -f /opt/homeassistant/.homeassistant/home-assistant.log
    
    # Filter specific components
    grep "ERROR" /opt/homeassistant/.homeassistant/home-assistant.log
    grep "WARNING" /opt/homeassistant/.homeassistant/home-assistant.log
    
    # Check startup issues
    sudo journalctl -u homeassistant --since "10 minutes ago"

    6. Security Considerations

    Authentication and Access Control

    yaml
    # Add to configuration.yaml
    homeassistant:
      auth_providers:
        - type: homeassistant
        - type: trusted_networks
          trusted_networks:
            - 192.168.1.0/24
            - 127.0.0.1
          trusted_users:
            192.168.1.0/24:
              - user_id_here

    SSL/TLS Configuration

    yaml
    # Add to configuration.yaml
    http:
      ssl_certificate: /etc/ssl/certs/homeassistant.crt
      ssl_key: /etc/ssl/private/homeassistant.key
      ssl_profile: modern
      server_port: 8123
      cors_allowed_origins:
        - https://cast.home-assistant.io

    Firewall Configuration

    #### firewalld (RHEL/CentOS/Fedora)

    bash
    # Allow Home Assistant port
    sudo firewall-cmd --permanent --add-port=8123/tcp
    sudo firewall-cmd --reload
    
    # Create custom service
    sudo tee /etc/firewalld/services/homeassistant.xml > /dev/null <<EOF
    <?xml version="1.0" encoding="utf-8"?>
    <service>
      <short>Home Assistant</short>
      <description>Home Assistant automation platform</description>
      <port protocol="tcp" port="8123"/>
      <port protocol="udp" port="5353"/>
    </service>
    EOF
    
    sudo firewall-cmd --reload
    sudo firewall-cmd --permanent --add-service=homeassistant
    sudo firewall-cmd --reload

    #### ufw (Ubuntu/Debian)

    bash
    # Allow Home Assistant ports
    sudo ufw allow 8123/tcp comment 'Home Assistant'
    sudo ufw allow 5353/udp comment 'mDNS'
    
    # Enable firewall
    sudo ufw enable

    #### iptables

    bash
    # Add rules for Home Assistant
    sudo iptables -A INPUT -p tcp --dport 8123 -j ACCEPT
    sudo iptables -A INPUT -p udp --dport 5353 -j ACCEPT
    
    # Save rules (command varies by distribution)
    sudo iptables-save > /etc/iptables/rules.v4  # Debian/Ubuntu
    sudo service iptables save  # RHEL/CentOS

    SELinux Configuration (RHEL/CentOS/Fedora)

    bash
    # Allow Home Assistant to bind to port 8123
    sudo setsebool -P httpd_can_network_connect 1
    
    # Create custom SELinux policy if needed
    sudo ausearch -c 'hass' --raw | audit2allow -M homeassistant
    sudo semodule -i homeassistant.pp

    Security Best Practices

    yaml
    # Add to configuration.yaml
    http:
      use_x_forwarded_for: true
      trusted_proxies:
        - 127.0.0.1
        - ::1
      ip_ban_enabled: true
      login_attempts_threshold: 5
    
    # Enable additional security features
    logger:
      default: warning
      logs:
        homeassistant.components.http.ban: warning

    Reverse Proxy Setup

    #### nginx Configuration

    nginx
    # /etc/nginx/sites-available/homeassistant
    server {
        listen 80;
        server_name homeassistant.example.com;
        return 301 https://$server_name$request_uri;
    }
    
    server {
        listen 443 ssl http2;
        server_name homeassistant.example.com;
    
        ssl_certificate /etc/ssl/certs/homeassistant.crt;
        ssl_certificate_key /etc/ssl/private/homeassistant.key;
        ssl_protocols TLSv1.2 TLSv1.3;
        ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384;
    
        location / {
            proxy_pass http://127.0.0.1:8123;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_buffering off;
        }
    }

    #### Apache Configuration

    apache
    # /etc/apache2/sites-available/homeassistant.conf
    <VirtualHost *:80>
        ServerName homeassistant.example.com
        Redirect permanent / https://homeassistant.example.com/
    </VirtualHost>
    
    <VirtualHost *:443>
        ServerName homeassistant.example.com
    
        SSLEngine on
        SSLCertificateFile /etc/ssl/certs/homeassistant.crt
        SSLCertificateKeyFile /etc/ssl/private/homeassistant.key
        SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
        SSLCipherSuite ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384
    
        ProxyPreserveHost On
        ProxyRequests Off
        ProxyPass / http://127.0.0.1:8123/
        ProxyPassReverse / http://127.0.0.1:8123/
    
        RewriteEngine on
        RewriteCond %{HTTP:Upgrade} websocket [NC]
        RewriteCond %{HTTP:Connection} upgrade [NC]
        RewriteRule ^/?(.*) "ws://127.0.0.1:8123/$1" [P,L]
    </VirtualHost>

    API Token Management

    yaml
    # Create long-lived access tokens in Home Assistant UI
    # Navigate to Profile -> Long-Lived Access Tokens
    
    # Use in external applications
    Authorization: Bearer YOUR_LONG_LIVED_ACCESS_TOKEN

    7. Performance Tuning

    Resource Optimization

    yaml
    # configuration.yaml
    recorder:
      purge_keep_days: 3  # Reduce database size
      auto_purge: true
      commit_interval: 1
      exclude:
        domains:
          - automation
          - updater
        entity_globs:
          - sensor.weather_*
    
    # Reduce logging
    logger:
      default: warning
    
    # Optimize frontend
    frontend:
      javascript_version: latest

    Database Optimization

    #### SQLite (Default)

    yaml
    # configuration.yaml
    recorder:
      db_url: sqlite:////opt/homeassistant/.homeassistant/home-assistant_v2.db
      purge_keep_days: 7
      auto_purge: true

    #### PostgreSQL

    bash
    # Install PostgreSQL
    sudo dnf install -y postgresql postgresql-server  # RHEL/CentOS
    sudo apt install -y postgresql postgresql-contrib  # Debian/Ubuntu
    
    # Initialize and start PostgreSQL
    sudo postgresql-setup --initdb  # RHEL/CentOS
    sudo systemctl enable --now postgresql
    
    # Create database and user
    sudo -u postgres psql <<EOF
    CREATE DATABASE homeassistant;
    CREATE USER hass WITH PASSWORD 'secure_password';
    GRANT ALL PRIVILEGES ON DATABASE homeassistant TO hass;
    \q
    EOF
    yaml
    # configuration.yaml
    recorder:
      db_url: postgresql://hass:secure_password@localhost/homeassistant
      purge_keep_days: 7
      auto_purge: true

    Memory and CPU Optimization

    bash
    # For Raspberry Pi - increase swap
    sudo dphys-swapfile swapoff
    sudo sed -i 's/CONF_SWAPSIZE=100/CONF_SWAPSIZE=1024/' /etc/dphys-swapfile
    sudo dphys-swapfile setup
    sudo dphys-swapfile swapon
    
    # Add to /boot/config.txt
    gpu_mem=16
    disable_overscan=1

    Caching Configuration

    yaml
    # Enable caching for better performance
    http:
      use_x_forwarded_for: true
      trusted_proxies:
        - 127.0.0.1
    
    # Cache static files
    frontend:
      themes: !include_dir_merge_named themes
      extra_module_url:
        - /local/my-custom-card.js?v=1

    Monitoring and Metrics

    yaml
    # Add to configuration.yaml
    system_health:
    
    # Enable system monitor
    sensor:
      - platform: systemmonitor
        resources:
          - type: disk_use_percent
            arg: /opt/homeassistant
          - type: memory_use_percent
          - type: processor_use
          - type: last_boot
    
    # Enable Prometheus metrics
    prometheus:
      namespace: hass

    8. Backup and Restore

    What to Backup

    Essential files and directories:

  • /opt/homeassistant/.homeassistant/ (entire config directory)
  • SSL certificates (if used)
  • Database files (if using external database)
  • Custom components and themes
  • Backup Scripts

    bash
    #!/bin/bash
    # /usr/local/bin/homeassistant-backup.sh
    
    BACKUP_DIR="/backup/homeassistant"
    CONFIG_DIR="/opt/homeassistant/.homeassistant"
    DATE=$(date +%Y%m%d_%H%M%S)
    
    # Create backup directory
    mkdir -p "$BACKUP_DIR"
    
    # Stop Home Assistant
    sudo systemctl stop homeassistant
    
    # Create backup
    tar -czf "$BACKUP_DIR/homeassistant_backup_$DATE.tar.gz" \
        -C "/opt/homeassistant" ".homeassistant"
    
    # Start Home Assistant
    sudo systemctl start homeassistant
    
    # Keep only last 7 backups
    find "$BACKUP_DIR" -name "homeassistant_backup_*.tar.gz" -mtime +7 -delete
    
    echo "Backup completed: homeassistant_backup_$DATE.tar.gz"

    Restore Procedures

    bash
    #!/bin/bash
    # Restore Home Assistant from backup
    
    BACKUP_FILE="/backup/homeassistant/homeassistant_backup_20250923_120000.tar.gz"
    CONFIG_DIR="/opt/homeassistant/.homeassistant"
    
    # Stop Home Assistant
    sudo systemctl stop homeassistant
    
    # Backup current config (safety)
    sudo mv "$CONFIG_DIR" "${CONFIG_DIR}.$(date +%Y%m%d_%H%M%S)"
    
    # Restore from backup
    sudo tar -xzf "$BACKUP_FILE" -C "/opt/homeassistant"
    
    # Fix permissions
    sudo chown -R homeassistant:homeassistant "$CONFIG_DIR"
    
    # Start Home Assistant
    sudo systemctl start homeassistant
    
    echo "Restore completed from $BACKUP_FILE"

    Automated Backup Setup

    bash
    # Add to crontab for automated daily backups
    sudo crontab -e
    
    # Add this line for daily backups at 2 AM
    0 2 * * * /usr/local/bin/homeassistant-backup.sh >> /var/log/homeassistant-backup.log 2>&1

    Testing Restore Procedures

    bash
    # Test restore on separate system
    # 1. Install Home Assistant on test system
    # 2. Stop service
    # 3. Replace config with backup
    # 4. Start service and verify functionality
    # 5. Test automations and integrations
    
    # Verify backup integrity
    tar -tzf /backup/homeassistant/homeassistant_backup_latest.tar.gz | head -20

    9. System Requirements

    Minimum Hardware Requirements

    CPU: Dual-core processor (ARM or x86)

  • ARM: Raspberry Pi 3B+ or equivalent (ARM Cortex-A53 1.4GHz)
  • x86: Intel Celeron N3450 or equivalent
  • Recommended: Quad-core 1.5GHz+ for optimal performance
  • Memory (RAM):

  • Minimum: 2GB for basic setup
  • Recommended: 4GB for production use
  • Optimal: 8GB+ for large installations with many devices
  • Storage:

  • Minimum: 32GB for basic installation
  • Recommended: 64GB+ SSD for production
  • Database: Additional 10GB+ for history retention
  • I/O: SSD strongly recommended for database performance
  • Network:

  • Connectivity: Ethernet preferred, Wi-Fi acceptable
  • Bandwidth: Minimum 10Mbps for cloud integrations
  • Latency: <100ms for responsive automation
  • Operating System Compatibility

    Officially Supported:

  • RHEL-based: RHEL 8/9, CentOS Stream, Rocky Linux 8/9, AlmaLinux 8/9
  • Debian-based: Debian 11/12, Ubuntu 20.04/22.04/24.04 LTS
  • Arch-based: Arch Linux, Manjaro, EndeavourOS
  • Alpine Linux: 3.18+ (containerized deployments)
  • SUSE-based: openSUSE Leap/Tumbleweed, SLES 15 SP5+
  • Secondary Support:

  • macOS: 12+ (Monterey and later)
  • FreeBSD: 13+ (community maintained)
  • Windows: WSL2 only (development/testing)
  • Software Dependencies

    Python Requirements:

  • Version: Python 3.10+ (3.11+ recommended)
  • Packages: pip, venv, wheel, setuptools
  • Development: build tools, headers, libraries
  • System Libraries:

  • Networking: libffi, openssl, systemd (Linux)
  • Bluetooth: bluez-libs (for Bluetooth integrations)
  • Compilation: gcc, make, pkg-config
  • Optional Dependencies:

  • MQTT: Mosquitto broker for device communication
  • Database: PostgreSQL/MySQL for external database
  • Zigbee/Z-Wave: USB dongles and drivers
  • Performance Scaling

    Small Installation (1-50 devices):

  • 2GB RAM, dual-core CPU, 32GB storage
  • SQLite database sufficient
  • Single instance deployment
  • Medium Installation (50-200 devices):

  • 4GB RAM, quad-core CPU, 128GB SSD
  • PostgreSQL recommended for database
  • Consider external MQTT broker
  • Large Installation (200+ devices):

  • 8GB+ RAM, 6+ core CPU, 256GB+ SSD
  • Dedicated database server
  • Load balancing and clustering options
  • Network optimization required
  • 10. Support

    Official Resources

    Documentation and Help:

  • Official Documentation - Comprehensive guides and references
  • Installation Guide - Platform-specific installation instructions
  • Configuration Reference - YAML configuration documentation
  • Troubleshooting - Common issues and solutions
  • Development and Source:

  • GitHub Repository - Source code and issue tracking
  • GitHub Discussions - Questions and community help
  • Release Notes - Version updates and breaking changes
  • Community Support

    Forums and Communities:

  • Home Assistant Community - Official community forum
  • Reddit r/homeassistant - Active community discussions
  • Discord Server - Real-time chat support
  • Home Assistant Podcast - Weekly news and tips
  • Learning Resources:

  • YouTube Channel - Official tutorials and demonstrations
  • Home Assistant Companion - Mobile app documentation
  • Awesome Home Assistant - Curated resources list
  • Commercial Support

    Professional Services:

  • Nabu Casa - Cloud services and professional support
  • Home Assistant Cloud - Remote access and voice integration
  • Home Assistant Green - Official hardware solution
  • Training and Certification:

  • Community workshops and meetups
  • Online training courses (third-party)
  • Integration partner certification programs
  • Getting Help

    Before Seeking Help:

    1. Check the official documentation

    2. Search the community forum

    3. Review GitHub issues

    4. Verify your configuration with hass --script check_config

    When Reporting Issues:

  • Include Home Assistant version (hass --version)
  • Provide relevant configuration snippets
  • Include error messages from logs
  • Describe steps to reproduce the issue
  • Specify your operating system and hardware
  • Response Expectations:

  • Community forum: 1-3 days typical response
  • GitHub issues: 1-7 days for bugs
  • Discord: Real-time community support
  • Commercial support: Based on service level agreement
  • 11. Contributing

    Ways to Contribute

    Code Contributions:

  • Bug fixes and feature improvements
  • New integration development
  • Core platform enhancements
  • Documentation improvements
  • Translation and localization
  • Community Contributions:

  • Forum support and assistance
  • Creating tutorials and guides
  • Sharing configurations and automations
  • Testing beta releases
  • Organizing local meetups
  • Development Setup

    Preparation:

    bash
    # Fork the repository on GitHub
    # Clone your fork locally
    git clone https://github.com/YOUR_USERNAME/core.git
    cd core
    
    # Set up development environment
    python3 -m venv venv
    source venv/bin/activate
    pip install -e .

    Code Standards:

  • Follow PEP 8 Python style guidelines
  • Use Black for code formatting
  • Write comprehensive tests for new features
  • Include docstrings for all public functions
  • Follow semantic versioning principles
  • Testing:

    bash
    # Run specific tests
    pytest tests/components/your_integration/
    
    # Run all tests (time-consuming)
    pytest
    
    # Check code style
    black --check homeassistant/
    pylint homeassistant/

    Submitting Contributions

    Pull Request Process:

    1. Create a feature branch from dev

    2. Make your changes with clear commit messages

    3. Add tests for new functionality

    4. Update documentation as needed

    5. Submit pull request with detailed description

    Review Process:

  • Automated testing runs on all submissions
  • Code review by core team members
  • Integration testing in staging environment
  • Merge approval required from maintainers
  • Integration Development:

  • Use the integration blueprint
  • Follow the developer documentation
  • Test with real hardware when possible
  • Include configuration examples
  • Documentation Contributions

    Types of Documentation:

  • Integration documentation
  • Installation guides
  • Configuration examples
  • Troubleshooting guides
  • Translation improvements
  • Documentation Guidelines:

  • Write for intermediate-level users
  • Include working code examples
  • Use consistent formatting and style
  • Test all provided commands and configurations
  • Keep content up-to-date with current versions
  • Recognition

    Contributor Recognition:

  • Contributors page on GitHub
  • Annual contributor acknowledgments
  • Community hall of fame
  • Special badges for significant contributions
  • 12. License

    Home Assistant Software License

    Apache License 2.0:

    Home Assistant Core is released under the Apache License 2.0, which permits:

  • Commercial use - Use in commercial applications
  • Modification - Create derivative works
  • Distribution - Share original or modified versions
  • Patent use - Grant of patent rights from contributors
  • Private use - Use for personal projects
  • License Requirements:

  • Include copyright notice in distributions
  • Include copy of license with distributions
  • State changes made to original code
  • Include NOTICE file if present in distribution
  • Core Dependencies:

  • Python: PSF License (compatible with Apache 2.0)
  • aiohttp: Apache License 2.0
  • PyYAML: MIT License
  • Jinja2: BSD License
  • Integration-Specific Licenses:

  • Integration libraries may have different licenses
  • Check individual integration documentation
  • Most integrations use compatible open-source licenses
  • Some integrations require API keys or accounts
  • This Guide License

    MIT License:

    This installation guide is licensed under the MIT License:

    text
    MIT License
    
    Copyright (c) 2025 HowToMgr
    
    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:
    
    The above copyright notice and this permission notice shall be included in all
    copies or substantial portions of the Software.
    
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    SOFTWARE.

    Third-Party Licenses

    Hardware Drivers:

  • USB device drivers (varies by manufacturer)
  • Zigbee/Z-Wave libraries (varies by implementation)
  • Bluetooth stack components (varies by OS)
  • Cloud Service Integration:

  • API access subject to third-party terms
  • Cloud services have separate privacy policies
  • Integration may require service subscriptions
  • License Compliance

    For Distributions:

  • Include all required license notices
  • Provide source code access if modified
  • Document any changes made to original code
  • Respect trademark and attribution requirements
  • For Commercial Use:

  • Apache 2.0 permits commercial applications
  • No royalty or licensing fees required
  • Consider contributing improvements back to community
  • Respect integration service terms of use
  • 13. Acknowledgments

    Core Development Team

    Founding and Leadership:

  • Paulus Schoutsen - Creator and project founder
  • Franck Nijhof - Core developer and Supervisor maintainer
  • Pascal Vizeli - Core developer and Add-on ecosystem
  • Bram Kragten - Frontend and user experience
  • Erik Montnemery - Core architecture and integrations
  • Major Contributors:

  • The Home Assistant Core team for continuous development
  • Integration developers for device support
  • Frontend developers for user interface improvements
  • Documentation team for comprehensive guides
  • Translation team for internationalization
  • Community Recognition

    Integration Developers:

  • Over 2000 integrations contributed by community
  • Device manufacturers providing support and documentation
  • Third-party developers creating custom components
  • HACS (Home Assistant Community Store) maintainers
  • Community Support:

  • Forum moderators and active helpers
  • Discord community managers
  • YouTube content creators and educators
  • Blogger and documentation contributors
  • Technology Acknowledgments

    Core Technologies:

  • Python Software Foundation - Python programming language
  • aiohttp - Asynchronous HTTP client/server framework
  • Jinja2 - Template engine for configuration
  • PyYAML - YAML parser and emitter
  • SQLAlchemy - Database abstraction layer
  • Frontend Technologies:

  • Lit - Web components library
  • Material Design - User interface components
  • Polymer - Web component framework (legacy)
  • Chart.js - Data visualization library
  • Hardware Ecosystem

    Supported Protocols:

  • Zigbee Alliance - Zigbee protocol development
  • Z-Wave Alliance - Z-Wave protocol standards
  • Thread Group - Matter/Thread protocol
  • Wi-Fi Alliance - Wi-Fi standards and certification
  • Hardware Partners:

  • Raspberry Pi Foundation for affordable computing
  • Intel NUC series for compact home servers
  • USB device manufacturers for dongles and adapters
  • Smart device manufacturers for integration support
  • Special Thanks

    Nabu Casa:

  • Sustainable funding for core development
  • Cloud services and remote access solutions
  • Professional support and hosting infrastructure
  • Home Assistant Green hardware development
  • Community Infrastructure:

  • GitHub for hosting and collaboration tools
  • Discord for community communication platform
  • Discourse for community forum hosting
  • Various CDN and hosting providers
  • Open Source Projects:

  • All dependencies and libraries used
  • Docker for containerization support
  • Linux distributions for platform support
  • Open source hardware projects for inspiration
  • Recognition Programs

    Annual Awards:

  • Outstanding integration developer recognition
  • Community contribution awards
  • Documentation excellence recognition
  • Translation and localization appreciation
  • This project stands on the shoulders of giants in the open source community, and we are grateful for all contributions, large and small, that make Home Assistant possible.

    14. Version History

    Release Timeline

    Major Releases:

    2025.x Series (Current)

  • Enhanced Matter/Thread support
  • Improved mobile application features
  • Advanced automation blueprints
  • Performance optimizations
  • Security enhancements
  • 2024.x Series

  • Voice control improvements
  • Energy management features
  • New dashboard layouts
  • Enhanced device discovery
  • Streamlined onboarding
  • 2023.x Series

  • Introduction of assist voice features
  • Improved backup and restore
  • Enhanced security features
  • New integrations ecosystem
  • Mobile app enhancements
  • 2022.x Series

  • Matter protocol support introduction
  • Advanced scene management
  • Improved performance metrics
  • Enhanced debugging tools
  • Cloud integration improvements
  • 2021.x Series

  • Modern frontend redesign
  • Energy monitoring features
  • Advanced automation editor
  • Improved mobile experience
  • Enhanced device management
  • Breaking Changes History

    Recent Breaking Changes:

  • YAML configuration validation improvements
  • Deprecated integration removals
  • Python version requirement updates
  • Database schema optimizations
  • API endpoint standardization
  • Migration Guidelines:

  • Always backup before major version upgrades
  • Review release notes for breaking changes
  • Test configurations in development environment
  • Update integrations and custom components
  • Follow deprecation warnings and timelines
  • Installation Guide Versions

    This Guide Version History:

    v1.0.0 (2025-09-23)

  • Complete SPEC 2.0 compliance implementation
  • Added all 16 required sections in proper order
  • Enhanced security and performance sections
  • Improved troubleshooting and backup procedures
  • Updated for current Home Assistant versions
  • Previous Versions:

  • Initial creation with basic installation instructions
  • Multi-OS support implementation
  • Advanced configuration additions
  • Security hardening procedures
  • Performance optimization guidance
  • Compatibility Matrix

    Python Versions:

  • Python 3.11: Recommended (current)
  • Python 3.10: Supported
  • Python 3.9: Deprecated (security updates only)
  • Python 3.12: Testing (future support)
  • Operating System Support:

  • RHEL/CentOS 8/9: Full support
  • Ubuntu 20.04/22.04/24.04: Full support
  • Debian 11/12: Full support
  • Arch Linux: Community support
  • Alpine Linux: Container support
  • macOS 12+: Development support
  • Future Roadmap

    Planned Enhancements:

  • Expanded Matter device support
  • Advanced AI/ML integration features
  • Improved mobile application capabilities
  • Enhanced voice control options
  • Better cloud integration options
  • Community Requested Features:

  • Simplified configuration management
  • Enhanced backup/restore capabilities
  • Improved multi-user management
  • Advanced scheduling features
  • Better debugging and monitoring tools
  • Deprecation Schedule

    Planned Deprecations:

  • Legacy YAML automation format (2026)
  • Older Python versions (following Python EOL)
  • Deprecated integrations (case-by-case basis)
  • Legacy frontend components (gradual migration)
  • End-of-Life Support:

  • Python 3.9: December 2025
  • Legacy configuration formats: June 2026
  • Older mobile app versions: Rolling 2-year support
  • 15. Maintenance

    Update Procedures

    Update Home Assistant Core:

    bash
    # Switch to homeassistant user
    sudo -u homeassistant -H -s
    cd /opt/homeassistant
    source bin/activate
    
    # Update pip and Home Assistant
    python -m pip install --upgrade pip
    python -m pip install --upgrade homeassistant
    
    # Check for breaking changes before updating
    # Visit: https://www.home-assistant.io/blog/categories/release-notes/
    
    # Restart service
    sudo systemctl restart homeassistant

    Update Python dependencies:

    bash
    # Update all packages
    python -m pip list --outdated
    python -m pip install --upgrade package_name
    
    # Or update all at once (use with caution)
    python -m pip freeze | cut -d'=' -f1 | xargs python -m pip install --upgrade

    Version Upgrades

    Major version upgrades:

    bash
    # Before upgrading, always backup
    /usr/local/bin/homeassistant-backup.sh
    
    # Check breaking changes
    # Visit release notes at: https://www.home-assistant.io/blog/
    
    # Perform upgrade
    sudo -u homeassistant -H -s
    cd /opt/homeassistant
    source bin/activate
    python -m pip install --upgrade homeassistant
    
    # Check configuration after upgrade
    hass --script check_config -c .homeassistant
    
    # Restart service
    sudo systemctl restart homeassistant

    Migration Between Systems

    Export configuration:

    bash
    # Create migration package
    tar -czf homeassistant_migration.tar.gz \
        -C /opt/homeassistant .homeassistant \
        --exclude=.homeassistant/home-assistant.log \
        --exclude=.homeassistant/home-assistant_v2.db
    
    # Copy SSL certificates if used
    tar -czf ssl_certs.tar.gz /etc/ssl/private/homeassistant.*

    Import on new system:

    bash
    # Install Home Assistant on new system
    # Stop service
    sudo systemctl stop homeassistant
    
    # Extract configuration
    sudo tar -xzf homeassistant_migration.tar.gz -C /opt/homeassistant
    sudo chown -R homeassistant:homeassistant /opt/homeassistant/.homeassistant
    
    # Update IP addresses and device paths in configuration
    sudo -u homeassistant nano /opt/homeassistant/.homeassistant/configuration.yaml
    
    # Start service
    sudo systemctl start homeassistant

    Cleanup Procedures

    Database cleanup:

    bash
    # Enable database purging
    # Add to configuration.yaml
    recorder:
      purge_keep_days: 7
      auto_purge: true
    
    # Manual purge
    sudo -u homeassistant -H -s
    cd /opt/homeassistant
    source bin/activate
    hass --script purge_db --days 30

    Log rotation:

    bash
    # Configure logrotate
    sudo tee /etc/logrotate.d/homeassistant > /dev/null <<EOF
    /opt/homeassistant/.homeassistant/home-assistant.log {
        daily
        missingok
        rotate 7
        compress
        notifempty
        copytruncate
        su homeassistant homeassistant
    }
    EOF

    Clear cache and temporary files:

    bash
    # Clear Home Assistant cache
    sudo -u homeassistant rm -rf /opt/homeassistant/.homeassistant/.cache
    sudo -u homeassistant rm -rf /opt/homeassistant/.homeassistant/deps
    
    # Clear pip cache
    sudo -u homeassistant python -m pip cache purge

    Integration Examples

    MQTT Device Integration:

    yaml
    # configuration.yaml
    mqtt:
      sensor:
        - name: "Temperature Sensor"
          state_topic: "home/livingroom/temperature"
          unit_of_measurement: "°C"
          device_class: temperature
    
        - name: "Humidity Sensor"
          state_topic: "home/livingroom/humidity"
          unit_of_measurement: "%"
          device_class: humidity
    
      switch:
        - name: "Living Room Light"
          state_topic: "home/livingroom/light/state"
          command_topic: "home/livingroom/light/set"
          payload_on: "ON"
          payload_off: "OFF"

    REST API Usage Examples:

    bash
    # Get states of all entities
    curl -X GET \
      -H "Authorization: Bearer YOUR_TOKEN" \
      -H "Content-Type: application/json" \
      http://localhost:8123/api/states
    
    # Control a switch
    curl -X POST \
      -H "Authorization: Bearer YOUR_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{"entity_id": "switch.living_room_light"}' \
      http://localhost:8123/api/services/switch/turn_on
    
    # Get specific entity state
    curl -X GET \
      -H "Authorization: Bearer YOUR_TOKEN" \
      http://localhost:8123/api/states/sensor.temperature

    Python Client Library Example:

    python
    # pip install homeassistant-api
    import homeassistant.remote as remote
    
    # Connect to Home Assistant
    api = remote.API('localhost', 'YOUR_TOKEN', 8123)
    
    # Get all states
    states = remote.get_states(api)
    for state in states:
        print(f"{state.entity_id}: {state.state}")
    
    # Turn on a light
    remote.call_service(api, 'switch', 'turn_on', {'entity_id': 'switch.living_room_light'})
    
    # Get state of specific entity
    state = remote.get_state(api, 'sensor.temperature')
    print(f"Temperature: {state.state}°C")

    Webhook Configuration:

    yaml
    # configuration.yaml
    automation:
      - alias: "Webhook Triggered Action"
        trigger:
          platform: webhook
          webhook_id: your_webhook_id
        action:
          service: notify.mobile_app_your_phone
          data:
            message: "Webhook triggered with data: {{ trigger.json }}"
    
    # URL to trigger webhook:
    # POST http://localhost:8123/api/webhook/your_webhook_id

    Zigbee2MQTT Integration:

    bash
    # Install Mosquitto MQTT broker
    sudo dnf install mosquitto mosquitto-clients  # RHEL/CentOS
    sudo apt install mosquitto mosquitto-clients  # Debian/Ubuntu
    
    # Start MQTT broker
    sudo systemctl enable --now mosquitto
    
    # Install Node.js and npm
    curl -fsSL https://rpm.nodesource.com/setup_18.x | sudo bash -
    sudo dnf install -y nodejs
    
    # Install Zigbee2MQTT
    sudo npm install -g zigbee2mqtt
    
    # Configure Zigbee2MQTT
    sudo mkdir -p /opt/zigbee2mqtt
    sudo tee /opt/zigbee2mqtt/configuration.yaml > /dev/null <<EOF
    homeassistant: true
    permit_join: false
    mqtt:
      base_topic: zigbee2mqtt
      server: 'mqtt://localhost'
    serial:
      port: /dev/ttyUSB0  # Adjust to your Zigbee dongle
    advanced:
      network_key: GENERATE
      pan_id: GENERATE
    EOF

    16. Appendices

    Appendix A: Command Reference

    Installation Commands:

    bash
    # Core installation
    python3 -m venv /opt/homeassistant
    source /opt/homeassistant/bin/activate
    python -m pip install homeassistant
    
    # Service management
    sudo systemctl start homeassistant
    sudo systemctl stop homeassistant
    sudo systemctl restart homeassistant
    sudo systemctl status homeassistant
    
    # Configuration validation
    hass --script check_config
    hass --script ensure_config
    
    # Database operations
    hass --script purge_db --days 30

    Troubleshooting Commands:

    bash
    # Log analysis
    sudo journalctl -u homeassistant -f
    tail -f /opt/homeassistant/.homeassistant/home-assistant.log
    
    # Network debugging
    sudo netstat -tlnp | grep 8123
    sudo lsof -i :8123
    
    # Permission fixes
    sudo chown -R homeassistant:homeassistant /opt/homeassistant
    sudo chmod -R 755 /opt/homeassistant

    Appendix B: Configuration Examples

    Basic configuration.yaml:

    yaml
    homeassistant:
      name: Home
      latitude: 32.87336
      longitude: 117.22743
      elevation: 430
      unit_system: metric
      time_zone: America/Los_Angeles
    
    frontend:
      themes: !include_dir_merge_named themes
    
    http:
      server_port: 8123
    
    recorder:
      purge_keep_days: 7
      auto_purge: true
    
    logger:
      default: info

    MQTT Integration:

    yaml
    mqtt:
      broker: localhost
      port: 1883
      username: !secret mqtt_username
      password: !secret mqtt_password
      discovery: true
      discovery_prefix: homeassistant

    Automation Example:

    yaml
    automation:
      - alias: "Motion Light"
        trigger:
          platform: state
          entity_id: binary_sensor.motion_sensor
          to: 'on'
        action:
          service: light.turn_on
          target:
            entity_id: light.living_room

    Appendix C: Integration Examples

    MQTT Device Integration:

    bash
    # Install Mosquitto MQTT broker
    sudo dnf install mosquitto mosquitto-clients  # RHEL/CentOS
    sudo apt install mosquitto mosquitto-clients  # Debian/Ubuntu
    
    # Start MQTT broker
    sudo systemctl enable --now mosquitto
    
    # Test MQTT communication
    mosquitto_pub -h localhost -t home/test -m "Hello World"
    mosquitto_sub -h localhost -t home/test

    Zigbee2MQTT Setup:

    bash
    # Install Node.js
    curl -fsSL https://rpm.nodesource.com/setup_18.x | sudo bash -
    sudo dnf install -y nodejs
    
    # Install Zigbee2MQTT
    sudo npm install -g zigbee2mqtt
    
    # Configuration
    sudo tee /opt/zigbee2mqtt/configuration.yaml > /dev/null <<EOF
    homeassistant: true
    permit_join: false
    mqtt:
      base_topic: zigbee2mqtt
      server: 'mqtt://localhost'
    serial:
      port: /dev/ttyUSB0
    advanced:
      network_key: GENERATE
      pan_id: GENERATE
    EOF

    Appendix D: API Reference

    REST API Examples:

    bash
    # Get all states
    curl -X GET \
      -H "Authorization: Bearer YOUR_TOKEN" \
      http://localhost:8123/api/states
    
    # Control a device
    curl -X POST \
      -H "Authorization: Bearer YOUR_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{"entity_id": "light.living_room"}' \
      http://localhost:8123/api/services/light/turn_on
    
    # Get configuration
    curl -X GET \
      -H "Authorization: Bearer YOUR_TOKEN" \
      http://localhost:8123/api/config

    WebSocket API:

    javascript
    const socket = new WebSocket('ws://localhost:8123/api/websocket');
    
    socket.onmessage = function(event) {
      const message = JSON.parse(event.data);
      console.log('Received:', message);
    };
    
    // Subscribe to state changes
    socket.send(JSON.stringify({
      id: 1,
      type: 'subscribe_events',
      event_type: 'state_changed'
    }));

    Appendix E: Hardware Compatibility

    Supported USB Devices:

  • Zigbee: ConBee II, Sonoff Zigbee 3.0, HUSBZB-1
  • Z-Wave: Aeotec Z-Stick 7, Zooz ZST10, Nortek QuickStick
  • 433MHz: RTL-SDR dongles, CC1101 transceivers
  • Recommended Hardware:

  • Raspberry Pi: 4B (4GB+ RAM recommended)
  • Intel NUC: Any recent generation with 4GB+ RAM
  • Generic x86: Minimum dual-core with 4GB RAM
  • Network Requirements:

  • Bandwidth: 10Mbps+ for cloud integrations
  • Latency: <100ms for responsive automation
  • Stability: Wired connection preferred for server
  • Appendix F: Troubleshooting Checklist

    Installation Issues:

  • [ ] Python version 3.10+ installed
  • [ ] Virtual environment activated
  • [ ] All dependencies installed
  • [ ] Sufficient disk space available
  • [ ] Proper user permissions set
  • Service Issues:

  • [ ] Service file syntax correct
  • [ ] User account exists and configured
  • [ ] Configuration file valid YAML
  • [ ] Port 8123 not in use by other services
  • [ ] Firewall allows connections
  • Performance Issues:

  • [ ] Sufficient RAM available
  • [ ] Database not too large
  • [ ] Log level not set to debug
  • [ ] Recorder excludes unnecessary entities
  • [ ] Network latency acceptable
  • Security Checklist:

  • [ ] Firewall configured properly
  • [ ] SSL/TLS certificates valid
  • [ ] Strong passwords used
  • [ ] API tokens rotated regularly
  • [ ] Updates applied promptly
  • ---

    Note: This guide is part of the HowToMgr collection. Always refer to official documentation for the most up-to-date information.