Moving to Home Assistant

I am busy moving away from my VeraEdge installation to a Home Assistant running on a Raspberry Pi 4. This is because it looks like the maker of the VeraEdge was bought and it is slowly being phased out.

For this I am using the following parts:

  • Geekwork X728 18650 UPS + X728-C1 case : This provides with a case (with cooling fan), UPS and RTC functionality.
  • Aeotec Z-Stick Gen5+ : For Z-Wave compatibility.
  • ConBee 2 : For ZigBee compatibility.
  • A Raspberry Pi 4 - 4GB
  • 64GB SD Card. Actually I wanted to use a 32GB SD card, but the 64GB had better specs and was only a couple os bucks more expensive.

I will be reusing these components:

Hardware build

Building the case is simple and straight forward. You can follow this video on youtube.

The steps are:

  • Open the case.
  • Install the fan.
  • Install the additional battery holder.
  • Install the power button.
  • Screw the spacers to the Raspberry Pi.
  • Insert the X728 UPS hat on top and screw in place.
  • Install batteries.
  • Plug connectors.
  • Screw the Raspberry Pi to the case.
  • Test that everything is in working order.
  • Optional: Set the jumper selector to auto power-on.
  • Close the case.

Case software

I did not like the software that comes with the case, so I rolled-up my own. The RTC uses the standard rtc-ds1307 which is in the Linux kernel. For GPIO programming I am using the /sysfs interface. The only component that requires custom programming was the battery charge and voltage readings. For that I wrote a small C program.

This is tied to systemd through these files:

In addition to this, I created a script to inject the Home Assistant Raspberry Pi image with the relevant files and also adds a RAUC post-install handler. so that OTA upgrades will keep these customizations.

As a bonus I am adding a munin-node systemd unit for system monitoring. And yes, I am old-fashioned.

Also, I am enabling ssh to the underlying Operating System.

Home Assistant installation

Following the raspberry pi installation guide is quite straight forward.

I chose to use the HAOS image install as it gives a more consumer device experience.

  • Download the 64bit image for Raspberry Pi 4 from the releases page
  • Use the haos-x728.sh to customize the image to include my X728 files.
  • Write the modified image to SD card.

Boot the raspberry pi from the new SD card and do the GUI installation. For my case, I needed to login to my router to look-up the IP address. It is configured via DHCP. I also statically assign an IP address and DNS name based on MAC address. To make sure that the DNS name and the host name match, I modified it on the configuration:

Settings -> System -> network

Modify hostname.

Initial configuration

Set up home areas. I set-up one area per room, following a naming convention:

F floor-number Room-name

For example:

  • F0 Kitchen
  • F2 Attic

Also, create additional areas for:

  • External : External items
  • System : System related entities and devices

For devices, I am using this naming convention:

  • Room-name room-section device optional

The idea is to make it simple to guess the name for voice recognition.

  • Room-name : this should match the area.
  • room-section : optional, section of the room this applies to.
  • device : device type.
    • Chromecast : google chromecast device
    • Display : google nest hub
    • TV : with optional casting, upnp or api
    • Skylight
    • Light
    • Switch
    • Double Switch
    • Remote: Remote control
    • Window Sensor
    • Door Sensor
  • optional : used for when multiple device of the same type are in the same room.

Add-Ons

I installed the followng add-ons:

  • Home Assistant Community Add-ons
    • Studio Code Server : for editing files. Press F1 and start typing home assistant to view available integration commands. This is needed because (unfortunately) not everything can be configured through the UI.
    • Z-Wave JS UI : Instead of Official add-ons. The community add-on gives you a control panel with more detailed control featires. Specifically you can set group associations.

Also, adding my own repository: https://github.com/iliu-net/hassio-addons

  • rsync-folders : save data and backups to remote server using rsync
  • watchdogdev : watchdog timer

Further Configuration

These configurations require modifying files. So usually I would do them after installing Studio Code Server.

Modifying authentications

To simplify login in local networks (specially to support physical control panels) I configured the trusted_networks by adding the following lines to your configuration.yaml.

homeassistant:
  auth_providers:
    - type: trusted_networks
      trusted_networks:
      - 192.168.2.0/24

Essentially what this does is that devices connecting from the trusted networks do not to login with username/password.

System temperature

For fun I also configured a CPU temperature sensor. Add this to configuration.yaml:

sensor:
  ### command line
  - platform: command_line
    name: CPU Temperature
    command: "cat /sys/class/thermal/thermal_zone0/temp" # RPi
    # command: "cat /sys/class/thermal/thermal_zone2/temp" # NUC
    # If errors occur, remove degree symbol below
    unit_of_measurement: "°C"
    value_template: "{{ '%.1f' | format(value | multiply(0.001)) }}" # RPi & NUC
    unique_id: sys_cpu_temp

Integrations

DSMR Slimme Meter

This integration is to read energy consumption as provided by NL smart meters. Just make sure that you get the right cable. I am using a cable from ROBBshop. Just plug and add to the integrations.

To include:

  • Add Integration : DSMR Slimme Meter
  • Serial : connection
  • Select device: Select the right serial port (should be easy to identify).
  • DSMR Version : 5

This is very easy to add and configure.

ZigBee Home Automation

This integration is automatically discovered for supported coordinators. I am using a ConBee II ZigBee coordinator. As long as the device is supported (see compatibility list ) things are fairly easy and simple.

There are multiple options for ZigBee support. I opted for ZHA because it has fairly good device support and is easy to use and set-up.

The alternatives are:

  • Zibgee2MQTT
    • Good for power users, execellent configuratbility and the best device support
    • It can be complicated.
  • deCONZ Add-On
    • Made by the ConBee2 developers. There are no real benefits to using this integration.

Z-Wave automation

For Z-Wave I am using the Z-Wave JS integration paired with a Aeotec Z-Stick Gen5.

I am using the Z-Wave JS UI from Community Add-ons because that gives you a control panel user interface that is handy when debugging obscure Z-Wave issues and also has support for creating direct node group associations.

In most day to day situations, I don't really use this control panel, as most operations can be done from the Home Assistant integration directly.

When adding this, it is not possible to do it from the auto-discovered z-stick gen5 as that will automatically install the core Z-Wave JS add-on. So just ignore it and use the Add Integration functionality and pick Z-Wave JS integration from the menu. This will let you skip the standard add-on installation and let you specify the right Z-Wave JS UI add-on instead.

Other integrations

  • Buienradar : Dutch weather data. Just add it and it works mostly out of the box.
  • DLNA media servers : these are discovered automatically as long as they are in the same Subnet.
  • Google Cast : These are also discovered automatically. Used for Android TV devices and Google Nest speakers/displays.
  • Printer : This was automatically discovered.
  • Waze Travel Time : Show the commute time between two points.
  • Netherlands Vehicle Authority : Yes, this can be done, but not sure its use. Maybe to remind you that the APK is due?
  • Philips TV : Installing this integration is quite straight forward. This enables automation options, but I don't know what to do with it yet. Also has the limitation that it can't be turned on using the API.
  • Jellyfin : Add a Jellyfin server as a media source. Note that only a single Jellyfin can be configured.

References