Set up Raspberry Pi with Home Assistant

These instructions show you how to install Home Assistant and the Mosquitto MQTT broker onto a Raspberry Pi 2B. Be aware – you will erase anything on that SD card, so make sure you’re okay with that.

  1. Download
  2. Install SDFormatter and Disk Imager
  3. Format the SD card with SDFormatter
  4. Extract the .img file from the Raspbian Jessie zip file
  5. Write the .img file to the SD card with Win32DiskImager – DO NOT GET THIS WRONG; writing this image to the wrong drive will ruin your day
  6. Install the SD card into the Raspberry Pi and start the Pi
  7. Open a terminal window and download the Home Assistant software
    $ sudo pip3 install homeassistant
    $ sudo pip3 install --upgrade homeassistant
  8. Configure the Pi to run Home Assistant on startup
    $ sudo su -c 'cat <> /lib/systemd/system/home-assistant.service
    Description=Home Assistant
    # Next line is to run as a specific user
    # for Raspberry Pi users, keep it at 'pi'
  9. You need to reload systemd to make the daemon aware of the new configuration. Enable and launch Home Assistant after that.
    $ sudo systemctl –system daemon-reload
    $ sudo systemctl enable home-assistant
    $ sudo systemctl start home-assistant
  10. Reboot the Pi. When the GUI returns, open a terminal window and enter
    $ sudo systemctl status home-assistant -l
    which should show something like
    home-assistant.service - Home Assistant
    Loaded: loaded (/usr/lib/systemd/system/home-assistant.service; disabled; vendor preset: disabled)
    Active: active (running) since Thu 2015-06-25 23:38:37 CEST; 3min 13s ago
    Main PID: 8557 (python3.4)
    CGroup: /system.slice/home-assistant.service
    └─8557 /usr/bin/python3.4 -m homeassistant
  11. Install Mosquitto (yes, it’s spelled that way)
  12. The Home Assistant configuration file is located within ~/.homeassistant. Get used to finding this file – you’ll be tweaking it a lot! Edit configuration.yaml as follows:
    broker: (use the Pi's IP address here)
    port: 1883
    client_id: home-assistant-1
    keepalive: 60
    username: USERNAME (pick a username)
    password: PASSWORD (pick a password)