Step-by-step how-to guide connect the P1 Landis+Gyr Energy meter, on a Raspberry Pi 4, with the latest Raspbian Buster image and Domoticz.
This how-to is part of a bigger series of Domoticz how-to’s on sancla.com!
Until recently most Dutch household’s where provided with an old analog energy meter, for electricity and natural gas. These meters have been replaced in recent years (per designation of Dutch law) with a new generation P1 smart energy meters. Apart from the fact that the energy companies can now remotely read out the meters, they are also equipped with a local data port. This port can be utilized to constantly monitor these energy-meters including the meter values.
In this how-to we are going to connect this smart meter to our Raspberry Pi based Domoticz installation.
This tutorial has been verified with: Domoticz 2020.1
TFDI FT232RL based USB to serial to RJ11 cable (P1 cable)
USB to serial to RJ11 cable
Our Chinese friends are well versed in preparing and making P1 cable solutions that also work well in combination with Domoticz. Under prerequisites are 2 links included with which you can order them ready-made. Also, these cables can often be ordered well through European web shops with a shorting shipping time (but often the price is higher).
For this post I ordered a cable from China and took it apart for you, so that you can see for yourself how they work. That way you can save even more costs by ordering the parts separately in China and assembling them yourself.
Configuring the P1 Smart Meter
Once you have the right cable, you can hook it up to your energy meter and Domoticz. After this, configure the new hardware device as follows:
Name: P1 Energy Meter
Type: P1 Smart Meter USB
Data Timeout: Disabled
Serial Port: Select your USB to serial adapter, in this case the TFDI FT232RL chip based adapter
Baudrate: 115200 bits per second (baud)
CRC message validation: Enabled
Rate Limit: empty
It can take a while for all devices to become visible in Domoticz, as these devices will only receive an update if the value in the meter changes. For example the gas meter, it will often take a while before it becomes visible. Certainly in the summer, when gas consumption is low, this can take some time.
Step-by-step how-to guide install and configure Duplicati with the latest Raspbian Buster image and Domoticz.
Duplicati is a fantastic and very intuitive backup solution that support a wide range of backup targets. Combined with a webinterface, this makes it perfect for a backup solution for our beloved Domoticz installation.
Duplicati supports not only various online backup services like OneDrive, Amazon S3, Backblaze, Rackspace Cloud Files, Tahoe LAFS, and Google Drive, but also any servers that support SSH/SFTP, WebDAV, or FTP.
It does however need the mono framework as it is mainly written for the Windows platform and this makes it a bit heavy for Linux. Nonetheless, it’s one of my favorite open-source backup products.
Next is to edit the initscript file with the following command:
sudo nano /etc/default/duplicati
It should resemble the below configuration. You have to add the last “DAEMON_OPTS…” line to the file and save the changes. To exit and save the changes, press CTRL+X first and confirm to save the file with “Y”).
# Defaults for duplicati initscript
# sourced by /etc/init.d/duplicati
# installed at /etc/default/duplicati by the maintainer scripts
# This is a POSIX shell fragment
# Additional options that are passed to the Daemon.
DAEMON_OPTS="--webservice-interface=any --webservice-port=8200 --portable-mode"
Step 7: Enable Duplicati service
Now its time to enable and start the service. Execute the following commands:
You should now have Duplicati up-and-running and see the below results of a running service:
Step 8: Open the Duplicati web-gui
Next is to navigate to the web interface/gui. It is configured in the initscript file to run on port 8200. In my case, the IP address of my Raspberry Pi is 10.1.3.51. So in order the reach the web gui, I have to open the following address in my browser:
The first time you open the Duplicati interface, choose the first option “No, my machine has only a single account”.
You should now be able to configure a backup job!
A couple of tips when creating a backup job (see screenshots below for further guidance):
Include one of these directories:
Enable automatic backup in the Domoticz setup menu so you get consistent backups of your database.
Keep your encryption password in a safe place that you can find back should you ever need it (or just do not use an encryption password)!!
You can also run scripts in advance or after the backup
Configure backup retention to automatically clean up old backups.
However, besides making sure your Raspberry Pi 4 gets proper cooling, it doesn’t hurt to monitor the temperature in Domoticz. Doing so also enables you to configure alerting if the temperature gets to high and cool down your Raspberry Pi with a big bucket of conductive water…..
This tutorial has been verified with: Domoticz 2020.1
After a couple of minutes, the internal devices are starting to appear under devices. Click on the green button to enable the monitoring of the device. You can give it a any name you want, such as “Internal Temperature” for example:
The temperature of your Raspberry Pi is now visible in Domoticz under temperature. You can take the same steps for the other sensors should you wish to monitor them.
As shown in above image, you can configure “Notifications” for each enabled device. So you receive a notification if your Raspberry Pi is starting to run to hot: