Electronics Home Automation Raspberry Pi

Home Assistant Setup in 2022

This post details our journey with Home Assistant since we first tried the software in 2016 and various upgrades with our hardware sensors and software to automate some of our home.

In the 10 years since our first Raspberry Pi data logger was added to our home the home data logging and automation system has grown with the addition of many sensors, using a mixture of wired, Wi-Fi and ZigBee wireless communication.

We moved to using Home Assistant from home-assistant.io in 2016 to give more detailed data logging than our online home logger at home.briandorey.com/ which updates every five minutes.

This is our third installation and configuration of Home Assistant since we first started using the platform. The first was running on a Raspberry Pi and using older 1-Wire sensors with a USB dongle and 433 Mhz wireless sensors. We didn’t plan the sensor names in Home Assistant which resulted in a mess of names and sensor locations.

The second installation fixed the naming issue with sensors prefixed with their type and then location. We also added ZigBee sensors and the MQTT server. This was in use for several months on a Raspberry Pi until the SD card corrupted and we lost all the data.

The current third installation replaced the 1-Wire USB dongle and we moved to run on our small Linux home server using a Docker image running in its own container. The MQTT server which is used to store many of the sensors data also runs in a docker container on the same machine.

Screen shots

Overview Page
Overview Page
Electric Usage
Electric Usage
Home Energy
Home Energy
Loft Power
Loft Power
Media Players
Media Players
Network Storage
Network Storage
Environmental  Sensors
Environmental Sensors
Solar PV
Solar PV

The Home Automation blog category has posts showing the progress over the past ten years.

Our current sensor setup are as follows:

Power Monitoring

We use a custom ESP8266 mains energy monitor which sends data to the MQTT server which logs incoming gas and electric usage. For individual devices we are using the following sensors:

TP-Link Kasa Smart KP115
TP-Link Kasa Smart KP115 WiFi Plug with energy monitoring

Used to monitor two of our computers and the network cupboard power consumption.

Samsung Smart Plug GP-WOU019BBDWG
Samsung Smart Plug GP-WOU019BBDWG

Used to monitor and control TVs and media devices.

Sonoff POW R2 Smart Switch
Sonoff POW R2 Smart Switch

We use a pair of modified POWR2 Smart Switches to monitor the Washing machine and tumble dryer in the kitchen.

Shelly ?? dual channel energy monitoring
Shelly EM dual channel energy monitoring

The Shelly EM uses two current transformers and monitors the loft workshop workbench circuit and reflow oven circuit.

Environmental and Door Sensors

We have 1-Wire hard wired temperature sensors for the hot water system which connect to an Arduino Uno which then sends serial data to the Linux PC and MQTT server. For each of the rooms and doors we are using the following sensors:

Sonoff Temperature and humidity sensor (SNZB-02)
Sonoff SNZB-02

Sonoff SNZB-02 zigbee temperature & humidity sensor which uses a 3V CR2450 battery

Xiaomi Aqara temperature, humidity and pressure sensor (WSDCGQ11LM)
Xiaomi Aqara WSDCGQ11LM

Monitors temperature, humidity, and atmospheric pressure in real time. which uses a 3V CR2032 battery

Xiaomi Aqara door & window contact sensor (MCCGQ11LM)
Xiaomi Aqara MCCGQ11LM

Detects if a window or door is open in real time. 3V CR2032 battery

TuYa Radiator valve with thermostat (TS0601_thermostat)
TuYa Radiator valve with thermostat

Zibgee TS0601 Radiator valve with thermostat which uses 4 AA batteries. Read more about our experiences with this TRV.

Automations Setup

Since moving to Home Assistant we have setup several useful automations to send status reports and alerts.

TV Auto Off

This monitors the TV smart plug and after the TV has been on standby for more than 5 minutes it turns off the TV and sound bar power. We use Sonoff smart buttons to toggle the TV power status. This has helped to reduce standby power used by the TV and media devices.

- alias: 'Brian TV Auto Off'
    - platform: numeric_state
      entity_id: sensor.tplinkbriantv_current_consumption
      below: '30'
      for: '00:05:00'
  condition: []
  - type: turn_off
    device_id: 70ce7f6ebfd4dd9355e91efd24b2654c
    entity_id: switch.tplinkbriantv
    domain: switch
  mode: single

Low Temp Alert Water Tank Area

We have a temperature sensor installed next to our water tank in the loft. This automation sends a message to a mobile phone if the temperature drops below 10C.

- alias: Low Temp Alert Water Tank Area
  description: ''
    - minutes: /30
      platform: time_pattern
    - condition: numeric_state
      entity_id: sensor.temploftwater_temperature
      below: '10'
    - service: notify.mobile_app_brians_phone
        message: Low air temperature in the loft water tank {{states.sensor.temploftwater_temperature.state }} c

Loft Windows nightly check

This runs at 8:30pm every night to check if the loft windows are open and sends an alert via the mobile apps if the windows have been left open.

- id: '1234567890'
  alias: Loft Windows Night Check
  description: ''
  - platform: time
    at: '20:30'
  - condition: or
    - condition: state
      entity_id: binary_sensor.loft_window_one_contact
      state: 'on'
    - condition: state
      entity_id: binary_sensor.loftwindowright_contact
      state: 'on'
  - service: notify.all_ios
      message: Loft Window is open
  mode: single

The following automations are available to download from GitHub.

  • Daily Email, This sends an email once a day with a report of the hours the doors and windows have been open during the day.
  • Loft TRV (Radiator valve) temperature setting depending on the loft hatch being opened or closed.
  • Low sensor battery alerts for battery powered sensors.
  • Synology NAS high temperature alerts.
  • Washing Machine Cycle finished alert based on power consumption.

The configuration files for our Home Assistant installation can be downloaded from GitHub at https://github.com/briandorey/MyHomeAssistantConfiguration



Leave a reply

Your email address will not be published. Required fields are marked *

Share this post

Support the blog

AB Electronics Raspberry Pi shop