For example, you can read your smart meter with a Raspberry Pi


fuse box

Almost everyone nowadays has a smart meter, but did you know that you can get more information from your meter than you think? With a Raspberry Pi, a cable and software you can gain more insight into your energy consumption. In this article, we’ll explain how to get started.

Everyone a smart meter

About four million households now have a smart meter. This measures your power consumption and passes this along with the readings of the gas meter via the mobile network. Handy for the energy supplier and network operator, who can read consumption data and gain insight into peaks or disruptions on the energy network. But also useful for you, because you can gain more insight into your consumption and, for example, the return of solar panels. In addition to an internet portal of your energy supplier or an independent service, you can also keep track of the consumption yourself via the data port on the smart meter, the so-called P1 port.

Buy smart meters

Insight through independent service

For example, if you want to keep it simple this free service use. After verification of your address, you can gain insight into your usage through your account using graphs. A nice bonus is that you can compare your consumption with people in your area or with the same living situation. The consumption data is not very detailed, especially for those older than two months, and it is not real-time. You also give a third party access to your consumption data. That is why we are going to work with software to keep track of consumption.

Read your smart meter yourself

Anyone who wants to read their smart meter themselves only needs a Raspberry Pi. The latest model is the Raspberry Pi 4, but the Raspberry Pi 3 model B is also available, in fact we used this one for this article. You also need a cable for the P1 port of the smart meter (see step 5) and some software on a micro-SD card. We look at two software options. The first is P1 monitor that has been specifically developed for reading the smart meter. Furthermore, reading the smart meter is mainly the domain of home automation software. We are watching Domoticz that offers the most important options for reading the smart meter.

Raspberry Pi and micro SD card

Just like Domoticz, P1 monitor has been specifically developed for the Raspberry Pi. P1 monitor works best on a Raspberry Pi 3 model B and should also work on the Raspberry Pi 4. The Pi 3 model B + is also supported since the last version and should work a bit smoother. Although it also works on a Raspberry Pi 2, this is not recommended due to the somewhat slower processor.

Domoticz works well on both the Pi 2 and 3 and 4, but you can also install fine on, for example, a Linux server or NAS, for example from Synology.

Cable for the smart meter

As you can read later in this workshop, there are different protocols for communicating with the smart meter and also different communication settings. Fortunately, there are not many different cables, although it is wise to check in advance whether a cable is really suitable for your smart meter. The cable is for sale at various web shops such as Cedel.nl or SOS Solutions, costs just under 20 euros and is suitable for most meters. You can also find them cheaper (for example at Chinese webshops) or build them yourself, but then you have less guarantee that it will work.

Measure almost in real time

Both P1 monitor and Domoticz can display the current electricity and gas consumption and also, on the basis of graphs, the historical consumption. By specifying your energy rates, you can also provide insight into the associated costs. The current consumption is almost real time: this is passed on by the smart meter every 10 seconds. So you can see the influence of a device that you switch on. You receive the data for gas consumption less often, which is usually passed on by the smart meter every hour.

Installation on micro-SD card

In addition to the ready-to-use 8 GB image for the Raspberry Pi 3 model B (+) do you also have the USB Image Tool required. Insert a micro SD card into the card reader, select the card reader in USB Image Tool and choose Restore. Point to the image file and put it on the micro-sd card. It may fail if there is still data on the micro-sd card. You can often solve that with the option Reset in USB Image Tool or with a tool like SD Formatter.

Settings for the smart meter

Place the micro-SD card in the Pi. Connect network cable, power cable and the smart meter cable and start the Pi. Then P1 monitor is ready for you in the browser http: // p1mon. Check via Information / P1 port status whether data is received from the smart meter. If not, you need to adjust the serial settings via Settings / P1 port. Use the default login details (username root, password tor). There are a few common combinations that almost always work (see box ‘Smart meter protocols’). If the first data arrives after adjusting the settings (this can take up to ten seconds), the status changes to green.

Smart meter protocols

Communication with a smart meter via the P1 port is laid down in the dsmr protocol (Dutch Smart Meter Requirements). Well-known versions are dsmr 3, 4 and 5. The latter offers some nice advantages, such as measurement data per second instead of ten seconds. P1 monitor is set by default for dsmr 3 with a baud rate of 9600 bit per second, 7 data bits, even parity and 1 stop bit. This is most common at meters from Iskra and Kamstrup. For smart meters with dsmr 4 or 4.2, which we often see with Kaifa and Landis + Gyr, the baud rate is usually 115200 bits per second with 8 data bits, no parity and 1 stop bit.

Use space micro-SD card

Have you installed P1 monitor on a micro-SD card larger than 8 GB? The extra space is not used by default, but it is easily solved by logging into the Pi with PuTTY or another ssh client. Use p1mon as host name and the default login data (username root, password tor). From the shell, start the raspi-config tool with the command sudo raspi-config. Choose Advanced Options and then Expand Filesystem. After that, reboot the Pi, when prompted, and log in again. Check with the command df -h whether the file system / dev / root has indeed grown to (almost) the entire size of the micro-sd card.

Set energy tariffs

Before you get started with the P1 monitor, it is useful to check the settings via Settings. For example, it is useful to translate your usage data into costs. below prices you can indicate your rates for electricity and gas. You can also set a limit value. That is the target amount for your costs per month. In the overview with costs you can see this as a boundary line, so that you can immediately see whether you stay over or under the desired monthly amount.

View consumption data

Under the Home-icon you will find four icons for overviews of current or historical consumption. The first icon shows the current electricity consumption, with the total for today on the right and a graph with the consumption of the last four hours at the bottom. If you also give electricity back to the energy grid, you can do this under the heading Delivery see. The second icon shows the historical electricity consumption in graphs (per hour, day, month or year). You can also zoom in on this even further if you want. In a similar way, you can view graphs for gas consumption in the following overview. The last overview shows the costs incurred.

Add weather information

Through Settings you can go under Again enter an API key that you can use for free OpenWeatherMap can create after registering a profile. Note that it takes about ten minutes for a created API key to be active. In P1 monitor you enter the API key and the desired location, preferably provided with the country, for example Amsterdam, nl. Finally, choose Save and go through Exit back to the overview screen. P1 monitor will now show in the gas consumption graph via a pop-up what the minimum, average and maximum temperature was at that time.

Import and export data

It is important to backup all measurements from time to time. For this you go to Settings / in-export. By on export Pressing it creates a zip file containing all historical data, in the form of sql statements. This allows the database to be refilled at a later time, via the option import. Do you want to upgrade to a newer version of P1 monitor? Then it is best to export all data first, then write a new image on the micro-sd card and finally import the old data again.

Read out with Domoticz

You can also read the smart meter with Domoticz, software for home automation. The software shows the current consumption and also presents beautiful graphs and reports with the historical consumption, where you can export data if desired. Although Domoticz is slightly less extensive than the P1 monitor on this point, it does offer all the important functions, and of course a lot of extra options for automation in and around the house. Moreover, in Domoticz you can make flexible use of notifications or use the consumption data in other ways, for example in self-written scripts.

Set in Domoticz

Domoticz can be set in different ways and works on many devices. The installation instructions are a good starting point. If you want to install Domoticz on a NAS of Synology, you can go to for current packages www.jadahl.com. Support for the smart meter is already built into Domoticz. To do this, go to Settings / Hardware and add the device named P1 Smart Meter USB. Then choose from the list Serial port the USB port to which you connected the cable. You can find this out via the shell, but you can also just try it out. Also set the other details, such as the baud rate which can be 9600 or 115200 bit per second depending on your meter.

Zoom in on your consumption

In Domoticz you can go under the tab Others see what the current consumption of electricity is and how much gas you have burned in total today. Press Log to see graphs for today and for the past week, month and year. The graph per month is especially useful for picking out peak days, the annual graph is useful to discover long-term trends in your consumption. You can optionally export charts as an image or database file, and the option Report shows consumption data as a list.

Receive notifications

In addition to monitoring consumption via the Domoticz user interface, you can also set up notifications, so that you are warned if consumption exceeds a certain threshold, for example. For this you use the option Notifications which is shown in the block for electricity and gas. Here you can choose via which systems a notification should be sent. This can be done by e-mail, for example, but also with a notification directly on your smartphone. If you have an Android smartphone Pushbullet a nice option for that. You still have to configure the notifications yourself via the Domoticz settings.

Measure water consumption

If you have mapped your energy consumption properly, you may also want to keep track of your water consumption. You can of course also save on this and it is also better for the environment if you use water sparingly. Since a few months, the P1 monitor has been offering the possibility to read the water meter. This requires some extra actions. In this article explains how that works.

.

Recent Articles

Related Stories

Stay on op - Ge the daily news in your inbox