Home assistant

From IOT4 Ltd
Jump to: navigation, search

Install the Home Assistant

First install the [Home Assisstant] from the https://home-assistant.io/ page.

Start the Home Assistant

When installed the daemon you will be can start it with command: hass --daemon , first time need minutes to recompile all need package.

Upgrade the Home Assistant

You will can upgrade the home assisstant with the command:  pip3 install --upgrade homeassistant 

Setup the Smart Home device

When logged in one of the IOT4 Smart Home device you can setup the hostname on the General tab, which will be the end of the mqtt topic.

Set hostname.png

After that you can change the mqtt topic at the MQTT tab.

Set mqtt topic.png

Set the hostname and root topic

If you have more than one device recommend to left the original hostname or insert the chipid somehow into the hostname, because you will cant identify after the devices! The {identifier} placeholder will be replaces by the device hostname.

In the state_topic filed insert the root topic which you set, the end tag in the :

state_topic: "/iot4/switch/IOT4SH01DS_122F85/temperature"

  • IOT4SH01DS is /temperature
  • IOT4SH01RELAY is /relay/0
    • IOT4SH01BME is /pressure for the pressure sensor data
    • IOT4SH01BME is /humidity for the humidity sensor data
    • IOT4SH01BME is /temperature for the temperature sensor data
    • IOT4SH01BMP is /pressure for the pressure sensor data
    • IOT4SH01BMP is /temperature for the temperature sensor data

Example configuration.yaml

And here the example configuration.yaml from my setup:


homeassistant:
  # Configuration template by www.iot4.eu
  # Name of the location where Home Assistant is running
  name: Eger
  # Location required to calculate the time the sun rises and sets
  latitude: 47
  longitude: 20
  # Impacts weather/sunrise data (altitude above sea level in meters)
  elevation: 200
  # metric for Metric, imperial for Imperial
  unit_system: metric
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: Europe/Budapest


zone:
  name: Hadnagy
  latitude:  47
  longitude: 20
  radius: 50
  icon: mdi:home

# Show links to resources in log and frontend
introduction:

# Enables the frontend
frontend:

http:
  # Uncomment this to add a password (recommended!)
  # api_password: PASSWORD
  # Uncomment this if you are using SSL or running in Docker etc
  # base_url: example.duckdns.org:8123

# Checks for available updates
updater:

# Discover some devices automatically
discovery:

# Allows you to issue voice commands from the frontend in enabled browsers
conversation:

# Enables support for tracking state changes over time.
history:

# View all events in a logbook
logbook:

# Track the sun
sun:

# Weather Prediction
sensor:
- platform: yr
#IOT4SH01DS temperature MQTT topic
- platform: mqtt
  state_topic: "/iot4/switch/IOT4SH01DS_122F85/temperature"
  name: "Nappali"
  unit_of_measurement: "C"
#IOT4SH02RELAY multi temperature MQTT topic
- platform: mqtt
  state_topic: "/iot4/switch/IOT4SH02RELAY2_DS_dolgozo/temperature/0"
  name: "Dolgozo radiátor"
  unit_of_measurement: "C"
- platform: mqtt
  state_topic: "/iot4/switch/IOT4SH02RELAY2_DS_dolgozo/temperature/1"
  name: "Kint"
  unit_of_measurement: "C"
- platform: mqtt
  state_topic: "/iot4/switch/IOT4SH02RELAY2_DS_dolgozo/temperature/2"
  name: "Dolgozó"
  unit_of_measurement: "C"

#IOT4SH02RELAY BME280 readings
- platform: mqtt
  state_topic: "/iot4/switch/IOT4SH01RELAY1_DS_CFEDB3/humidity"
  name: "Fürdő páratartalom"
  unit_of_measurement: "%"

#IOT4SH01BME humidity,temperature and pressure topic
- platform: mqtt
  state_topic: "/iot4/IOT4SH01BME_E4B879/humidity"
  name: "Nappali páratartalom"
  unit_of_measurement: "%"
- platform: mqtt
  state_topic: "/iot4/IOT4SH01BME_E4B879/temperature"
  name: "Nappali BME hőmérséklet"
  unit_of_measurement: "C"
- platform: mqtt
  state_topic: "/iot4/IOT4SH01BME_E4B879/pressure"
  name: "Nappali BME légnyomás"
  unit_of_measurement: "hPa"

switch:
#IOT4SH01RELAY mqtt control topic
- platform: mqtt
  name: "LED"
  state_topic: "/iot4/switch/LED/relay/0"
  command_topic: "/iot4/switch/LED/relay/0"
  payload_on: "1"
  payload_off: "0"
#IOT4SH02BLINDER mqtt control topic
- platform: mqtt
  name: "Fel"
  state_topic: "/iot4/IOT4SH02_BLINDER_828D81/relay/0"
  command_topic: "/iot4/IOT4SH02_BLINDER_828D81/relay/0"
  payload_on: "1"
  payload_off: "0"
- platform: mqtt
  name: "Le"
  state_topic: "/iot4/IOT4SH02_BLINDER_828D81/relay/1"
  command_topic: "/iot4/IOT4SH02_BLINDER_828D81/relay/1"
  payload_on: "1"
  payload_off: "0"

# Text to speech
tts:
  platform: google

#connect to local mqtt broker
mqtt:
  broker: localhost
  port: 1883
  client_id: home-assistant-1
  keepalive: 60
  username: None
  password: None
#  certificate: /home/paulus/dev/addtrustexternalcaroot.crt
  protocol: 3.1.1