Home Assistant

Home Assistant server to use for smart home devices. The integrated MQTT server is not used, instead we use a separate Mosquitto server at

Setup #

  1. Install according to:
  2. Setup autostart according to:
  3. Set the MQTT broker settings in /home/homeassistant/.homeassistant/configuration.yaml as follows:
      username: mosquitto
      password: pw
  4. Restart hass: systemctl restart homeassistent.service.

Access #

The web interface can be accessed at:

Add Sonoff device #

Configure the Sonoff device as follows:

MQTT Host:
MQTT Port:    1883
MQTT User:    mosquitto
MQTT Pass:    [pw]
MQTT Topic:   [unique identifier]

Add the following entry to /home/homeassistant/.homeassistant/configuration.yaml (light can be replaced with switch):

  - platform: mqtt
    name: "[insert description]"
    state_topic: "stat/[insert MQTT topic]/RESULT"
    value_template: '{{ value_json["POWER"] }}'
    command_topic: "cmnd/[insert MQTT topic]/POWER"
    availability_topic: "tele/[insert MQTT topic]/LWT"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    payload_available: "Online"
    payload_not_available: "Offline"
    retain: true

Restart hass: systemctl restart homeassistent.service.

Updates #