Featured image of post Homeassistant - Lessons learned on hard way

Homeassistant - Lessons learned on hard way

Lessons that I learned hard way on self hosting Homeassistant

My Homeassistant journey this far

My Homeassistant journey is about one year old. In that time I have learned some hard lessons on about managing Homeassistant server. Here is some of the main ones in arbitary order.

One zigbee network

I Used to have two separate Zigbee network, the network managed by Philips Hue gateway and separate ZHA network for sensors. One time when I was debugging the sensor ZHA network, I realized that I can have more reliable Zigbee network for combining Philips Hue lights on same network. On the backend Philips Hue uses Zigbee as technology. Because all the light bulbs and other wired Zigbee devices act as additional Zigbee Routers, the network will be more reliable and stable. Basically the Zigbee networks were interfering each others and sensor network wasn’t reaching edge of the network so much.

My current Zigbee Network visualized

External database and filters

First database corruption came about 2-3 months running Homeassistant. The main reason was that the disk of the HA server wen’t full and the default sqlite database currupted. I was able to fix the corruption merging the corrupted and new database.

I realized that I collected every sensor’s data to database. After the corruption I separated the main DB to MariaDB and long time data to InfluxDB.

I created includes.yaml file to HA’s configuration.yaml.

Here is example of the configurations:

configuration.yaml:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
recorder:
  db_url: !secret mariadb_url
  commit_interval: 20
  include: !include includes.yaml

influxdb:
  host: 127.0.0.1
  port: 8086
  database: homeassistant
  username: homeassistant
  password: !secret influxdb_pass
  max_retries: 3
  default_measurement: state
  include: !include includes.yaml

includes.yaml:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
domains:
  - automation
entity_globs:
  - sensor.shelly_*
  - sensor.nordpool_*
  - sensor.*_power
  - sensor.*_current
  - sensor.*_voltage
  - sensor.*_energy_*
  - sensor.*_energy
  - sensor.*_movement_counter
  - sensor.*_temperature
  - sensor.*_temperature_*
  - sensor.*_humidity
  - sensor.*_humidity_*
  - sensor.*_illuminance
  - sensor.wilfa_ilmankostutin_*
  - sensor.*_rssi
  - sensor.*_signal_strength
  - sensor.*_pressure
  - sensor.*_battery
  - sensor.*_luminosity
  - sensor.fordpass_*
  - sensor.disk_*
  - sensor.load_*
  - sensor.memory_*
  - sensor.network_*
  - sensor.packets_*
  - sensor.processor_*
  - sensor.swap_*
  - binary_sensor.*
  - sensor.lumi_*
  - sensor.lenovo_*
entities:
  - counter.wilho_vessalaskuri
  - climate.ilmalampopumppu
  - input_boolean.away_from_home
  - input_datetime.itsenaisyyspaiva
  - input_select.olohuone_scenes
  - sensor.mariadb_database_size
  - sensor.last_boot
  - sensor.uptime

Backups, backups, backups

Backups have saved my HA installation several times during this year. Sometimes I only need Zigbee network Backup and sometimes I have needed to restore whole installation when converting Homeassistant OS to Docker installation.

For now I take backups every Sunday and using automation to run backup service:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
alias: Weekly HomeAssistant Backup
trigger:
  - platform: time
    at: "01:00:00"
condition:
  - condition: time
    weekday:
      - sun
    after: "01:00:00"
action:
  - service: backup.create
    data: {}
mode: single

Investigate supported devices and stay on them

I Have bunch of unused not stable or working devices or using wrong technology devices.

For example I bought cheap temperature and humidity sensor from local cheap store. When finally I was able to connect them to my Zigbee coordinator, I lost connection to them and I didn’t get any messages from them.

Also I installed some WiFi controlled door sensor. After while I realized that door sensor had major delay lighting up doorways lights. Also I saw that connection wasn’t stable because it uses 2.4GHz WiFi frequency.

So I recommend to use well supported Zibee devices and only use WiFi if on last change. Usually WiFi controlled IoT Devices calls to separate Cloud and it’s adds more latency.

Physical switches are better that smart switches

It’s better to use physical smart switches than normal wireless smart switches.

Usually when HA has something wrong and Zigbee network is, The lights that are behind wireless smart switches comes useless when Zigbee network is down. Physical Smart switches still works when HA is down.

My Zigbee Dual Smart Switch that I use

Separate physical server on Homeassistant

Almost an year I run my Homeassistant on my NAS Server which included some other homelab softwares and also as the name suggests Network Area Storage for my LAN. Usually that ment that everytime I did some maintenance updates to my NAS Server the lights and other automation stopped working due to reboots. Often the reboots didn’t went succesfully because the Debian issues. So I went researching for the dedicated server for my Homeassistant.

My dedicated HomeAssistant Server

I was able to get cheaply used Lenovo ThinkCentre for this use. This is basically small and silent mini PC that has M2 SSD and 8GB RAM on it. Funny thing is that is has almost same CPU that my NAS server has (Intel i3-7100T (4 cores @ 3.400GHz). Perfect for HA.

Built with Hugo
Theme Stack designed by Jimmy