Here is my first blog post translated from Finnish to English. The original post was published on 30.7.2023 in Finnish.
I previously had my RuuviTag sensors connected to Home Assistant using a piece of software called RuuviTag Discovery, about which I also wrote a story back in the day. Lately, however, this configuration has started to act up more and more. This is apparently due to updates in the node.js packages, with which Ruuvitag Discovery no longer works properly.
For this reason, I started thinking about how it would make sense to connect the sensors to Home Assistant, since I don't have, for example, a Ruuvi Gateway in use. However, Home Assistant nowadays has a RuuviTag BLE integration, so I started to find out how the sensors could be added to the system using it.
Changes to the host system
I have Home Assistant installed in a container using Docker Compose, so first I had to install the necessary packages such as BlueZ on the host system, add the line bluetooth: to the configurations.yaml file, and finally restart Home Assistant.
Nothing happened, however, until I realized to read the Home Assistant documentation more carefully regarding the Bluetooth integration. The solution was found in the section Additional requirements by install method, which mentions that in a system installed with Docker, the host system must have BlueZ and the D-Bus socket in use, and they must also be available to Home Assistant inside the container. In other words, this is fixed by adding the following line under the volumes: section in the docker-compose.yaml file
- /run/dbus:/run/dbus:ro
Before restarting the Home Assistant container, this is the latest point at which you should take a backup of Home Assistant. In my case, what happened was that after the system restarted, all the old history data etc. had disappeared and Home Assistant started completely from a clean slate. This of course brought a bit of extra work, as the system had to be restored from old backups, but it went well nonetheless.
The data reset was most likely due to the fact that I accidentally added this /run/dbus:/run/dbus:ro line to the end of the docker-compose.yaml file in a new volumes section, which for some reason reset all the data.
Backing up Home Assistant
Backing up Home Assistant can be done in several ways, and I have it handled automatically with a browser-based application called Duplicati, about which I once wrote this story. A backup of the system can also be made manually via the terminal, as I did in this case — in other words, a copy of the Home Assistant folder is created. This is done via the terminal by giving the following command (you must of course be in the correct directory where the command is given)
sudo cp -r homeassistant homeassistant_backup
After the backup, the Home Assistant container is restarted with the command
sudo docker-compose up -d
Next, wait a moment for Home Assistant to start up again. After this, Home Assistant directly offers the Bluetooth integration to be taken into use, so let's enable it. Next, Home Assistant also automatically offers RuuviTag sensors to be taken into use. So now Home Assistant automatically finds the RuuviTag sensors within range and suggests adding them to the system.
Based on my own experience, the sensors have stayed in use well without problems. However, if it happens that Home Assistant does not find the RuuviTag sensors, the next thing to do is to update the firmware of the RuuviTags to the latest version. Updating the firmware usually fixes the situation at the latest.