Connect Smart Meter (P1) to Home Assistant
In the Netherlands, almost every home has a smart meter. It measures your electricity and gas consumption and has a P1 port: a small connection from which you can read the consumption live. With Home Assistant you can see exactly what you’re using right now, and build an energy dashboard with costs per day, month or year.
What do you need?
- A smart meter with P1 port. Most meters (DSMR 4 or 5) have one. Check the sticker or the menu on the meter for the version.
- A P1 cable: a USB cable with an RJ12 connector on one end that fits into the P1 port.
- A computer with Home Assistant near the meter (Raspberry Pi, mini-pc, Home Assistant Green or another installation). The cable is often only 1 or 2 meters long. Is your server far away? Then choose a wifi module (see below) or a separate Raspberry Pi or ESP32 board near the meter.
The P1 port is meant for reading: you can’t damage anything if you use the right cable. Never open or break the seal of the meter itself. If the port is not on according to your meter, ask your network operator how that works.
Option 1: USB P1 cable
- Insert the RJ12 end into the P1 port of the meter and the USB end into your Home Assistant computer.
- In Home Assistant go to Settings → Devices and services → Add integration and search for DSMR Slimme Meter.
- Choose Serial as connection and select the USB port of the cable.
- Choose the DSMR version. For most Dutch meters that’s 5; older meters use 4 and even older ones 2.2. Don’t know? Then try the versions one after the other.
Within a few seconds sensors appear for your consumption, return delivery, voltage, current per phase and the gas reading. If Home Assistant runs in Docker, pass the USB port to the container (for example --device=/dev/ttyUSB0).
Option 2: wifi module
Without cable is also possible with a wifi module that plugs into the P1 port. A well-known example is the HomeWizard P1 meter, which Home Assistant discovers itself via the integration HomeWizard Energy. You turn on the local API in the manufacturer’s app and add the device. You can also build an ESP32 yourself and connect it to the P1 port with ESPHome; see our ESPHome guide.
Setting up the energy dashboard
- Go to Settings → Dashboards → Energy.
- Choose your consumption at Elektriciteitsnet. If you have a day and night rate, add both meter sensors (rate 1 and rate 2).
- Do you have solar panels? Also add the return delivery, and possibly a sensor for your solar panels.
- Add your gas consumption and set your rate for each source: a fixed amount per kWh or per m³, or your own sensor with the dynamic rate.
After a day you’ll see graphs. Use the result to understand your consumption: if there’s still a substantial base consumption at night, there’s often something to turn off or replace. Want to know what a device costs per year? Use our Electricity costs tool.
If it doesn’t work
- No data: try a different DSMR version, check if the cable is properly in the port and see if the USB port is recognized (
dmesg | grep ttyon Linux). - Gas is missing or comes in slowly: the gas reading is only transmitted by the meter occasionally, often once every few minutes to per hour. That’s normal.
- Values jump: check the connection of the cable and use a USB extension cable if it sits next to other devices with lots of interference.
Sources and attribution
This article is written in our own words. Read more:
- DSMR Slimme Meter in the Home Assistant documentation;
- HomeWizard Energy in the Home Assistant documentation;
- The energy dashboard in the Home Assistant documentation.