This is how you can read your smart meter with a Raspberry Pi

Almost everyone has a smart meter these days, 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 explain how you can get started.

Everyone a smart meter

Around four million households now have a smart meter. It measures your power consumption and transmits this, together with the gas meter readings, via the mobile network. Handy for the energy supplier and network manager, who can read consumption data and gain insight into peaks or failures 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 using an internet portal from your energy supplier or an independent service, you can also keep track of consumption yourself via the data port on the smart meter, the so-called P1 port.

Buy smart meters

Insight through independent service

If you want to keep it simple, you can use this free service, for example. After verifying your address, you can gain insight into your consumption via graphs via your account. 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 ourselves to keep track of consumption.

Read your smart meter yourself

If you want to read out your smart meter yourself, all you need is 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 it 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 the P1 monitor, which has been specifically developed for reading the smart meter. Reading the smart meter is also primarily the domain of home automation software. We take a look at Domoticz that offers the most important options for reading the smart meter.

Raspberry Pi and micro SD card

Like Domoticz, P1 monitor was 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 discouraged by the somewhat slower processor.

Domoticz works well on both the Pi 2 and 3 and 4, but you can also install it on 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 communication 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 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.

Near real-time measurement

Both P1 monitor and Domoticz can show 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 transmitted 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 are usually passed on by the smart meter per hour.

Installation on micro SD card

In addition to the 8 GB ready-made image for the Raspberry Pi 3 model B(+), you also need the USB Image Tool. 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 this with the option Reset in USB Image Tool or with a tool like SD Formatter.

Smart meter settings

Insert the micro SD card into the Pi. Connect network cable, power cable and the smart meter cable and start the Pi. After that, P1 monitor is ready for you in the browser on //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 toor). There are a few common combinations that almost always work (see box 'Smart meter protocols'). When 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 bits 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.

Utilize space micro SD card

Have you installed P1 monitor on a micro SD card larger than 8 GB? The extra space isn't used by default, but it's easily solved by logging into the Pi with PuTTY or another ssh client. Usage p1mon as hostname and the default login credentials (username root, password toor). From the shell, start the raspi-config tool with the command sudo raspi-config. Choose Advanced Options and then Expand Filesystem. Then, when prompted, reboot the Pi and log in again. Check with the command df -h whether the filesystem /dev/root has indeed grown to (almost) the entire size of the micro-sd card.

Set energy rates

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

View usage data

Under the Homeicon you will find four icons for overviews of current or historical consumption. The first icon shows the current electricity consumption, with on the right the total for today and at the bottom a graph with the consumption of the last four hours. If you also return electricity to the energy network, you can do this under the heading Delivery to look at. The second icon shows the historical electricity consumption in graphs (per hour, day, month or year). You can also zoom in 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 Institutions can you under Weather enter an API key that you can create for free via OpenWeatherMap after registering a profile. Note that it takes about ten minutes before a created API key is active. In P1 monitor you enter the API key and the desired location, preferably 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 back up all measurements from time to time. For this you go to Settings / in-export. by on export pressing it creates a zip file with 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 first export all data, 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 P1 monitor in this respect, it does offer all the important functions, and of course many 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 up in Domoticz

Domoticz can be set up in different ways and works on many devices. The installation instructions are a good starting point. If you want to install Domoticz on a Synology NAS, you can go to for current packages. Support for the smart meter is already built into Domoticz. Go to Settings / Hardware and add the device named P1 Smart Meter USB. Then choose from the list at 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 under the tab Other see what the current consumption of electricity is and how much gas you have burned in total today. Press log to see charts for today and for the past week, month and the past year. The chart per month is especially useful to pick out peak days, the annual chart is useful to discover long-term trends in your consumption. Charts can optionally be exported 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 notifications, so that you are warned if, for example, consumption exceeds a certain threshold. 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, for example, by e-mail, but also with a notification directly on your smartphone. If you have an Android smartphone, Pushbullet is a great option for that. You still have to configure the notifications yourself via the Domoticz settings.

Measuring water consumption

If you have properly mapped out your energy consumption, 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 economically. P1 monitor has been offering a possibility to read out the water meter for a few months now. This requires some additional actions. This article explains how that works.

Recent Posts