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:
Enabled: Enabled
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
Configure the P1 hardware in Domoticz
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.
Sometimes Raspbian is still missing some required dependencies. Just to be sure, run the following command so we are not missing out on any:
sudo apt -f install -y
Step 5: Configure the service file
We need to edit the service file in order to make it possible to run this as a service. So go open the file with the nano text editor with the following command:
sudo nano /etc/systemd/system/duplicati.service
Copy-paste the following configuration and save the file. To exit and save the changes, press CTRL+X first and confirm to save the file with “Y”).
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:
Duplicati service is running correctly
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:
http://10.1.3.51:8200
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:
/home/pi
/home/pi/domoticz
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.
Include the pi home directory (or the lower level domoticz directory)Enable Backup retention or the pre-backup script optionYou can find the script option under Advanced OptionsEnable the default Domoticz Automatic Backup solution!!!
Should you need to restore…
If you ever need to restore, you can do so easily by clicking on the job and selecting to restore files, as seen in the screenshot below. Follow the steps with these instructions:
However, in the worst-case scenario, a F.U.B.A.R. situation, you don’t have a running pi anymore. For example, your SD-card or USB stick died… First 2 steps are to get your pi running again with a fresh installation of raspbian and Domoticz. Next is to install Duplicati again the guide below. Another option is to just install Duplicati on your own system to retrieve your files. See this link for more information and instructions https://duplicati.readthedocs.io/en/latest/03-using-the-graphical-user-interface/#restoring-files-if-your-duplicati-installation-is-lost
Further documentation
For more information on Duplicati, how to create a proper backup job and other documentation, you can visit this site:
Step-by-step how-to guide install the Internal Sensors on Raspberry Pi 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!
As most know by now, the Raspberry Pi 4 has the reputation to run hot. Perhaps hotter then we want, even with an idle CPU with Domoticz… One way to resolve this problem is cooling this beast.
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:
Motherboard Sensor devices appearing in Domoticz
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.
The internal Raspberry Pi temperature in Domoticz with the Flirc case
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:
Configuring notifications for the internal temperature sensor in Domoticz