<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Steven</title>
    <description>The latest articles on DEV Community by Steven (@eppiedude).</description>
    <link>https://dev.to/eppiedude</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3764686%2Fe66f4754-d2f5-4405-868d-5137132df740.png</url>
      <title>DEV Community: Steven</title>
      <link>https://dev.to/eppiedude</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/eppiedude"/>
    <language>en</language>
    <item>
      <title>From P1 Port to Home Assistant in 4 Hours: Reading a Belgian Smart Meter with ESP32</title>
      <dc:creator>Steven</dc:creator>
      <pubDate>Wed, 23 Sep 2026 19:08:06 +0000</pubDate>
      <link>https://dev.to/eppiedude/from-p1-port-to-home-assistant-in-4-hours-reading-a-belgian-smart-meter-with-esp32-25oj</link>
      <guid>https://dev.to/eppiedude/from-p1-port-to-home-assistant-in-4-hours-reading-a-belgian-smart-meter-with-esp32-25oj</guid>
      <description>&lt;p&gt;From P1 Port to Home Assistant in 4 Hours: Reading a Belgian Smart Meter with ESP32&lt;/p&gt;

&lt;p&gt;I wanted one simple thing: get the actual data from my Belgian digital meter into Home Assistant.&lt;/p&gt;

&lt;p&gt;No cloud service in between. No external energy-monitoring platform. No additional current clamps measuring something the smart meter already knows.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;The idea:&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;Belgian digital meter&lt;br&gt;
        ↓&lt;br&gt;
     P1 / DSMR&lt;br&gt;
        ↓&lt;br&gt;
      ESP32&lt;br&gt;
        ↓&lt;br&gt;
     ESPHome&lt;br&gt;
        ↓&lt;br&gt;
 Home Assistant&lt;/p&gt;

&lt;p&gt;About four hours after starting the project, that was exactly what I had.&lt;/p&gt;

&lt;p&gt;And the P1 connection turned out to provide considerably more than just a total electricity reading: live import and export, three-phase measurements, quarter-hour demand, the monthly peak and even my water meter.&lt;/p&gt;

&lt;p&gt;The last one led to another small addition: turning a cumulative water-meter reading into a useful Home Assistant state answering a much simpler question:&lt;/p&gt;

&lt;p&gt;Is water being used right now?&lt;/p&gt;

&lt;p&gt;This is how I built it.&lt;/p&gt;

&lt;p&gt;Why P1?&lt;/p&gt;

&lt;p&gt;My house already runs Home Assistant, and I'm gradually bringing more of its technical systems together into one local interface.&lt;/p&gt;

&lt;p&gt;The electricity meter is an obvious source of useful data.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;What I wanted:&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;current grid consumption&lt;br&gt;
current grid injection&lt;br&gt;
electricity consumption for tariff 1 and tariff 2&lt;br&gt;
electricity injection for tariff 1 and tariff 2&lt;br&gt;
voltage and current on all three phases&lt;br&gt;
import and export power per phase&lt;br&gt;
current quarter-hour demand&lt;br&gt;
maximum demand for the current month&lt;br&gt;
electricity interruptions&lt;br&gt;
cumulative water consumption&lt;br&gt;
whether water is currently being used&lt;/p&gt;

&lt;p&gt;Most importantly, I wanted the data to remain local.&lt;/p&gt;

&lt;p&gt;The digital meter already measures most of this. Adding another energy meter or a set of current clamps just to measure the same thing again seemed unnecessary.&lt;/p&gt;

&lt;p&gt;The P1 port is already there. So I decided to use it.&lt;/p&gt;

&lt;p&gt;Hardware&lt;/p&gt;

&lt;p&gt;&lt;u&gt;The hardware:&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;Smart meter: Belgian digital electricity meter with an enabled P1 port&lt;br&gt;
Controller: ESP32 development board&lt;br&gt;
Connection: RJ12 6P6C&lt;br&gt;
Pull-up: 10 kΩ resistor&lt;br&gt;
Power: separate power supply for the ESP32&lt;br&gt;
Firmware: ESPHome&lt;br&gt;
Automation: Home Assistant&lt;/p&gt;

&lt;p&gt;The ESP32 I used is configured as a standard esp32dev.&lt;/p&gt;

&lt;p&gt;For the serial connection, I'm using GPIO16 as the receive pin.&lt;/p&gt;

&lt;p&gt;The actual installation:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwjsj94rcl0tdhuwuqkz0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwjsj94rcl0tdhuwuqkz0.png" alt=" " width="800" height="845"&gt;&lt;/a&gt;&lt;br&gt;
The actual ESP32 P1 reader installed in my electrical cabinet. The annotations show the P1 signals used in this installation, including the separate Data Request and power connections, both ground references and the data connection to GPIO16.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;P1 connections:&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;Pin 1 — +5 V: P1 power supply&lt;br&gt;
Pin 2 — Data Request: held high to request telegrams&lt;br&gt;
Pin 3 — Data GND: ground reference for the data signal&lt;br&gt;
Pin 4 — NC: not connected&lt;br&gt;
Pin 5 — Data: serial data to GPIO16&lt;br&gt;
Pin 6 — Power GND: ground for the P1 power supply&lt;br&gt;
Why two positive and two ground connections?&lt;/p&gt;

&lt;p&gt;At first glance, the wiring can look a little strange.&lt;/p&gt;

&lt;p&gt;There are two connections on the positive side because they serve different purposes.&lt;/p&gt;

&lt;p&gt;Pin 1 provides +5 V, while pin 2 is Data Request. Data Request needs to be held high for the meter to transmit its telegrams.&lt;/p&gt;

&lt;p&gt;Likewise, there are two ground connections:&lt;/p&gt;

&lt;p&gt;Pin 3: Data GND&lt;br&gt;
Pin 6: Power GND&lt;/p&gt;

&lt;p&gt;They ultimately share the same ground reference in this installation, but they have different functions on the P1 connector.&lt;/p&gt;

&lt;p&gt;⚠️ Lesson learned the hard way:&lt;br&gt;
Don't copy RJ12 wire colours from someone else's cable.&lt;/p&gt;

&lt;p&gt;I did that once with a Home Assistant Zigbee dongle because I assumed two cables used the same colour scheme.&lt;/p&gt;

&lt;p&gt;The dongle did not appreciate that at all.&lt;/p&gt;

&lt;p&gt;Always identify the connector pins and signals first. Treat the wire colours as nothing more than colours.&lt;/p&gt;

&lt;p&gt;I first tried powering the ESP32 from P1&lt;/p&gt;

&lt;p&gt;Initially, I wanted the entire thing to run from the P1 connection.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;The ideal situation:&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;P1&lt;br&gt;
 ├── data&lt;br&gt;
 └── power&lt;br&gt;
       ↓&lt;br&gt;
     ESP32&lt;/p&gt;

&lt;p&gt;One connection for everything.&lt;/p&gt;

&lt;p&gt;So I tested it.&lt;/p&gt;

&lt;p&gt;In my particular setup, however, powering the ESP32 from the P1 connection wasn't reliable enough. The ESP32 did not operate consistently from the P1 supply alone.&lt;/p&gt;

&lt;p&gt;During troubleshooting I switched to a separate power source.&lt;/p&gt;

&lt;p&gt;That turned out to be useful for another reason: it separated two completely different possible problems.&lt;/p&gt;

&lt;p&gt;Is my P1 communication broken, or is the ESP32 simply not being powered reliably?&lt;/p&gt;

&lt;p&gt;With separate power, I could debug the data connection independently.&lt;/p&gt;

&lt;p&gt;Once everything worked, I decided to keep the ESP32 on a separate regulated supply rather than depending on the P1 port for power.&lt;/p&gt;

&lt;p&gt;This isn't meant as a universal statement that an ESP32 can never be powered from P1.&lt;/p&gt;

&lt;p&gt;It's simply what I found while testing this installation:&lt;/p&gt;

&lt;p&gt;P1 power wasn't reliable enough for my ESP32, while separate power was.&lt;/p&gt;

&lt;p&gt;First problem: no data&lt;/p&gt;

&lt;p&gt;The next problem had nothing to do with ESPHome.&lt;/p&gt;

&lt;p&gt;My P1 port wasn't enabled.&lt;/p&gt;

&lt;p&gt;You can have:&lt;/p&gt;

&lt;p&gt;correct wiring&lt;br&gt;
a working ESP32&lt;br&gt;
the right UART configuration&lt;br&gt;
a perfectly valid ESPHome configuration&lt;/p&gt;

&lt;p&gt;…and still receive absolutely nothing if the meter isn't transmitting.&lt;/p&gt;

&lt;p&gt;After activating the P1 port through the grid operators website, telegrams started arriving.&lt;/p&gt;

&lt;p&gt;💡 Lesson learned:&lt;br&gt;
Before debugging the receiver, make sure the transmitter is actually transmitting.&lt;/p&gt;

&lt;p&gt;ESPHome&lt;/p&gt;

&lt;p&gt;The ESP32 runs ESPHome using ESP-IDF.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;ESP32 configuration:&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;esphome:&lt;br&gt;
  name: p1-meter&lt;br&gt;
  friendly_name: P1 Meter&lt;/p&gt;

&lt;p&gt;esp32:&lt;br&gt;
  board: esp32dev&lt;br&gt;
  framework:&lt;br&gt;
    type: esp-idf&lt;/p&gt;

&lt;p&gt;&lt;u&gt;UART configuration:&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;uart:&lt;br&gt;
  id: p1_uart&lt;br&gt;
  rx_pin:&lt;br&gt;
    number: GPIO16&lt;br&gt;
    inverted: true&lt;br&gt;
  baud_rate: 115200&lt;br&gt;
  rx_buffer_size: 1700&lt;/p&gt;

&lt;p&gt;And then ESPHome's DSMR component handles the telegram:&lt;/p&gt;

&lt;p&gt;dsmr:&lt;br&gt;
  uart_id: p1_uart&lt;br&gt;
  max_telegram_length: 1700&lt;br&gt;
  water_mbus_id: 1&lt;/p&gt;

&lt;p&gt;Once a valid DSMR telegram appeared in the logs, most of the difficult debugging was over.&lt;/p&gt;

&lt;p&gt;The rest was largely a matter of deciding which data I actually wanted to expose.&lt;/p&gt;

&lt;p&gt;Electricity totals and live power&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Grid import and export:&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;sensor:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;platform: dsmr&lt;/p&gt;

&lt;p&gt;energy_delivered_tariff1:&lt;br&gt;
  name: "Afname tarief 1"&lt;/p&gt;

&lt;p&gt;energy_delivered_tariff2:&lt;br&gt;
  name: "Afname tarief 2"&lt;/p&gt;

&lt;p&gt;energy_returned_tariff1:&lt;br&gt;
  name: "Injectie tarief 1"&lt;/p&gt;

&lt;p&gt;energy_returned_tariff2:&lt;br&gt;
  name: "Injectie tarief 2"&lt;/p&gt;

&lt;p&gt;power_delivered:&lt;br&gt;
  name: "Actueel afnamevermogen"&lt;/p&gt;

&lt;p&gt;power_returned:&lt;br&gt;
  name: "Actueel injectievermogen"&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That gives me the cumulative electricity counters for both tariffs as well as the current direction of power flow.&lt;/p&gt;

&lt;p&gt;Home Assistant therefore knows whether the house is currently consuming electricity from the grid or injecting electricity back into it.&lt;/p&gt;

&lt;p&gt;Three-phase data&lt;/p&gt;

&lt;p&gt;My installation is three-phase, and the P1 telegram exposes measurements for each phase.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Voltage and current:&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;voltage_l1:&lt;br&gt;
  name: "Spanning L1"&lt;br&gt;
voltage_l2:&lt;br&gt;
  name: "Spanning L2"&lt;br&gt;
voltage_l3:&lt;br&gt;
  name: "Spanning L3"&lt;/p&gt;

&lt;p&gt;current_l1:&lt;br&gt;
  name: "Stroom L1"&lt;br&gt;
current_l2:&lt;br&gt;
  name: "Stroom L2"&lt;br&gt;
current_l3:&lt;br&gt;
  name: "Stroom L3"&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Power in both directions:&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;power_delivered_l1:&lt;br&gt;
  name: "Afnamevermogen L1"&lt;br&gt;
power_delivered_l2:&lt;br&gt;
  name: "Afnamevermogen L2"&lt;br&gt;
power_delivered_l3:&lt;br&gt;
  name: "Afnamevermogen L3"&lt;/p&gt;

&lt;p&gt;power_returned_l1:&lt;br&gt;
  name: "Injectievermogen L1"&lt;br&gt;
power_returned_l2:&lt;br&gt;
  name: "Injectievermogen L2"&lt;br&gt;
power_returned_l3:&lt;br&gt;
  name: "Injectievermogen L3"&lt;/p&gt;

&lt;p&gt;Instead of only knowing the total power consumption of the house, I can see exactly how that load is distributed over L1, L2 and L3.&lt;/p&gt;

&lt;p&gt;From monitoring to something more useful&lt;/p&gt;

&lt;p&gt;This is where the project becomes particularly interesting.&lt;/p&gt;

&lt;p&gt;The meter exposes the current average quarter-hour demand:&lt;/p&gt;

&lt;p&gt;active_energy_import_current_average_demand:&lt;br&gt;
  name: "Huidige kwartierpiek"&lt;/p&gt;

&lt;p&gt;And the maximum demand recorded during the running month:&lt;/p&gt;

&lt;p&gt;active_energy_import_maximum_demand_running_month:&lt;br&gt;
  name: "Maandpiek"&lt;/p&gt;

&lt;p&gt;These aren't values I'm reconstructing myself from thousands of Home Assistant samples.&lt;/p&gt;

&lt;p&gt;They come directly from the meter through DSMR.&lt;/p&gt;

&lt;p&gt;For my Flemish installation, those values are particularly interesting because peak demand is relevant to the capacity tariff.&lt;/p&gt;

&lt;p&gt;But more importantly, they give Home Assistant information it could eventually act upon.&lt;/p&gt;

&lt;p&gt;From monitoring to control:&lt;/p&gt;

&lt;p&gt;And suddenly, the project becomes more than a way of making energy graphs.&lt;/p&gt;

&lt;p&gt;It could become the foundation for an actual Energy Management System (EMS) in the future.&lt;/p&gt;

&lt;p&gt;Instead of simply visualizing the quarter-hour peak, Home Assistant could eventually use this data to actively manage flexible loads — and, with a home battery added later, decide when storing or using energy makes the most sense.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;The evolution:&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;Measure → Understand → Decide → Control&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;Quarter-hour demand approaching target&lt;br&gt;
                  ↓&lt;br&gt;
           Home Assistant&lt;br&gt;
                  ↓&lt;br&gt;
        postpone flexible load&lt;br&gt;
                  ↓&lt;br&gt;
           reduce the peak&lt;/p&gt;

&lt;p&gt;The ESP32 isn't an EMS.&lt;/p&gt;

&lt;p&gt;But it could provide some of the real-time data an EMS needs to make useful decisions.&lt;/p&gt;

&lt;p&gt;From raw P1 data to one Home Assistant screen&lt;/p&gt;

&lt;p&gt;Once the ESP32 was communicating correctly, ESPHome exposed the sensors through its native API and they became normal Home Assistant entities.&lt;/p&gt;

&lt;p&gt;I then brought the useful information together in my own touchscreen interface.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev-to-uploads.s3.us-east-2.amazonaws.com/uploads/articles/0fjwlmddpvhwzqg2eovn.png" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4qrj7eo728utla766ezh.png" alt=" " width="800" height="361"&gt;&lt;/a&gt;&lt;/p&gt;

Click the dashboard to open the full-resolution version.




&lt;p&gt;My current Home Assistant touchscreen energy view. Live grid import and export, quarter-hour and monthly peak, all three phases, cumulative electricity and water are fed by the P1 reader.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;One screen now gives me:&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;live import and export&lt;br&gt;
current quarter-hour demand&lt;br&gt;
monthly peak&lt;br&gt;
power per phase&lt;br&gt;
voltage per phase&lt;br&gt;
current per phase&lt;br&gt;
cumulative tariff counters&lt;br&gt;
cumulative water consumption&lt;br&gt;
today's water consumption&lt;br&gt;
monthly water consumption&lt;br&gt;
current P1 connection status&lt;/p&gt;

&lt;p&gt;The screenshot also illustrates why I wanted the raw data rather than a separate energy-monitoring app.&lt;/p&gt;

&lt;p&gt;The meter isn't another isolated system anymore.&lt;/p&gt;

&lt;p&gt;Its data has become part of the same interface as the rest of the house.&lt;/p&gt;

&lt;p&gt;And the measurement path remains local.&lt;/p&gt;

&lt;p&gt;And then there is the water meter&lt;/p&gt;

&lt;p&gt;This turned out to be one of the more interesting parts of the project.&lt;/p&gt;

&lt;p&gt;The P1 connection isn't necessarily limited to electricity. Additional meters can be exposed through the DSMR telegram as M-Bus devices.&lt;/p&gt;

&lt;p&gt;In my case, that includes my water meter.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Selecting the water meter:&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;dsmr:&lt;br&gt;
  uart_id: p1_uart&lt;br&gt;
  max_telegram_length: 1700&lt;br&gt;
  water_mbus_id: 1&lt;/p&gt;

&lt;p&gt;Then the actual sensor is simple:&lt;/p&gt;

&lt;p&gt;water_delivered:&lt;br&gt;
  name: "Waterverbruik"&lt;/p&gt;

&lt;p&gt;At that point Home Assistant knew the cumulative water-meter reading.&lt;/p&gt;

&lt;p&gt;But I wanted something slightly more useful than a number that slowly increases.&lt;/p&gt;

&lt;p&gt;Is water being used right now?&lt;/p&gt;

&lt;p&gt;Turning a meter reading into "water is running"&lt;/p&gt;

&lt;p&gt;The cumulative water value increases whenever new consumption is reported.&lt;/p&gt;

&lt;p&gt;So I used that behaviour.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Step 1 — Create a 30-second timer:&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;timer:&lt;br&gt;
  p1_waterafname_actief:&lt;br&gt;
    name: P1 waterafname actief&lt;br&gt;
    duration: "00:00:30"&lt;br&gt;
    restore: false&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Step 2 — Turn that timer into a binary sensor:&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;template:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;binary_sensor:

&lt;ul&gt;
&lt;li&gt;name: Waterafname actief
unique_id: p1_waterafname_actief
device_class: running
state: "{{ is_state('timer.p1_waterafname_actief', 'active') }}"&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;u&gt;Step 3 — Restart the timer whenever the water meter increases:&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;automation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;id: p1_waterafname_actief_bij_stijgende_meterstand&lt;br&gt;
alias: P1 waterafname actief bij stijgende meterstand&lt;br&gt;
mode: restart&lt;/p&gt;

&lt;p&gt;triggers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;trigger: state
entity_id: sensor.technische_ruimte_p1_energiemeter_waterverbruik&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;conditions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;condition: template
value_template: &amp;gt;-
  {{ trigger.from_state is not none
     and trigger.to_state is not none
     and is_number(trigger.from_state.state)
     and is_number(trigger.to_state.state)
     and trigger.to_state.state | float
         &amp;gt; trigger.from_state.state | float }}&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;actions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;action: timer.start
target:
  entity_id: timer.p1_waterafname_actief
data:
  duration: "00:00:30"&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;u&gt;The resulting logic:&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;Water meter increases&lt;br&gt;
        ↓&lt;br&gt;
Timer starts / restarts&lt;br&gt;
        ↓&lt;br&gt;
Water in use = ON&lt;br&gt;
        ↓&lt;br&gt;
No increase for 30 seconds&lt;br&gt;
        ↓&lt;br&gt;
Timer expires&lt;br&gt;
        ↓&lt;br&gt;
Water in use = OFF&lt;/p&gt;

&lt;p&gt;It's a tiny bit of logic, but it turns a cumulative utility meter into something considerably more useful for automation.&lt;/p&gt;

&lt;p&gt;I no longer only know how much water I've consumed.&lt;/p&gt;

&lt;p&gt;Home Assistant can also tell whether water is being consumed right now.&lt;/p&gt;

&lt;p&gt;Could this detect a water leak?&lt;/p&gt;

&lt;p&gt;Potentially, it could become one input for such a system.&lt;/p&gt;

&lt;p&gt;But I'm deliberately not calling this a leak detector.&lt;/p&gt;

&lt;p&gt;A rising meter reading tells me that water is being consumed.&lt;/p&gt;

&lt;p&gt;It doesn't tell me why.&lt;/p&gt;

&lt;p&gt;Once Home Assistant has that information, however, it can be combined with other state:&lt;/p&gt;

&lt;p&gt;Water continuously active&lt;br&gt;
        +&lt;br&gt;
Nobody home&lt;br&gt;
        +&lt;br&gt;
Unusually long duration&lt;br&gt;
        ↓&lt;br&gt;
Something worth investigating&lt;/p&gt;

&lt;p&gt;That's a much better basis for an actual alert than simply assuming that every long water event is a leak.&lt;/p&gt;

&lt;p&gt;Grid interruptions&lt;/p&gt;

&lt;p&gt;I also expose the interruption counters from the electricity meter:&lt;/p&gt;

&lt;p&gt;electricity_failures:&lt;br&gt;
  name: "Stroomonderbrekingen"&lt;/p&gt;

&lt;p&gt;electricity_long_failures:&lt;br&gt;
  name: "Lange stroomonderbrekingen"&lt;/p&gt;

&lt;p&gt;And the ESP32 itself exposes an online status:&lt;/p&gt;

&lt;p&gt;binary_sensor:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;platform: status
name: "Online"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That gives Home Assistant another small piece of information about both the electrical installation and the measurement path itself.&lt;/p&gt;

&lt;p&gt;The complete data path&lt;/p&gt;

&lt;p&gt;&lt;u&gt;The finished architecture:&lt;/u&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;         Belgian digital meter
                  │
                  │ P1 / DSMR
                  ▼
            ESP32 + ESPHome
                  │
      ┌───────────┼───────────┐
      │           │           │
Electricity     Peaks       Water
      │           │           │
      └───────────┼───────────┘
                  │
             ESPHome API
                  │
                  ▼
            Home Assistant
                  │
        ┌─────────┴─────────┐
        │                   │
    Dashboard          Automations
                            │
                            ▼
                   Water active state
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;No external API is required for this measurement path.&lt;/p&gt;

&lt;p&gt;No utility cloud needs to be queried.&lt;/p&gt;

&lt;p&gt;The data travels a few metres instead of travelling across the internet and back.&lt;/p&gt;

&lt;p&gt;About four hours from idea to working system&lt;/p&gt;

&lt;p&gt;The part that surprised me most was how quickly the core system came together.&lt;/p&gt;

&lt;p&gt;From the initial idea to seeing live smart-meter values inside Home Assistant took roughly four hours.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;That included:&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;figuring out how to read the Belgian P1 connection&lt;br&gt;
wiring the ESP32&lt;br&gt;
testing power from the P1 connection&lt;br&gt;
switching to separate power when that proved unreliable&lt;br&gt;
discovering that the P1 port wasn't enabled&lt;br&gt;
configuring the UART&lt;br&gt;
configuring ESPHome's DSMR component&lt;br&gt;
receiving a valid telegram&lt;br&gt;
exposing the relevant electricity sensors&lt;br&gt;
adding the ESP32 to Home Assistant&lt;br&gt;
getting live three-phase measurements&lt;br&gt;
exposing the peak-demand values&lt;br&gt;
getting the water meter into Home Assistant&lt;/p&gt;

&lt;p&gt;Some refinement came afterwards — particularly turning the water-meter changes into a useful live state and building the finished touchscreen interface around all the data.&lt;/p&gt;

&lt;p&gt;But the core path:&lt;/p&gt;

&lt;p&gt;meter → ESP32 → ESPHome → Home Assistant&lt;/p&gt;

&lt;p&gt;was working in one session.&lt;/p&gt;

&lt;p&gt;What I would do differently next time&lt;/p&gt;

&lt;p&gt;If I had to build another one tomorrow, I would debug it in strict layers.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;My debugging order would now be:&lt;/u&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Is the P1 port enabled?
         ↓&lt;/li&gt;
&lt;li&gt;Is the ESP32 powered reliably?
         ↓&lt;/li&gt;
&lt;li&gt;Is GPIO16 receiving valid UART data?
         ↓&lt;/li&gt;
&lt;li&gt;Can ESPHome parse a DSMR telegram?
         ↓&lt;/li&gt;
&lt;li&gt;Are the sensors appearing in Home Assistant?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In other words:&lt;/p&gt;

&lt;p&gt;P1 meter&lt;br&gt;
   ↓&lt;br&gt;
power + physical connection&lt;br&gt;
   ↓&lt;br&gt;
UART / ESP32&lt;br&gt;
   ↓&lt;br&gt;
DSMR parser&lt;br&gt;
   ↓&lt;br&gt;
ESPHome API&lt;br&gt;
   ↓&lt;br&gt;
Home Assistant&lt;/p&gt;

&lt;p&gt;💡 Lesson learned:&lt;br&gt;
Prove one layer before debugging the next.&lt;/p&gt;

&lt;p&gt;It sounds obvious afterwards.&lt;/p&gt;

&lt;p&gt;Most useful debugging lessons do.&lt;/p&gt;

&lt;p&gt;What's next?&lt;/p&gt;

&lt;p&gt;Getting the data was only the first step.&lt;/p&gt;

&lt;p&gt;Using it is more interesting.&lt;/p&gt;

&lt;p&gt;The quarter-hour and monthly peak values could eventually feed into active load management.&lt;/p&gt;

&lt;p&gt;I'm also looking at home battery storage, which makes live grid import and peak information even more useful.&lt;/p&gt;

&lt;p&gt;Instead of merely displaying a rising quarter-hour peak, Home Assistant could eventually use that information to decide when to postpone a flexible load or when stored energy should be used.&lt;/p&gt;

&lt;p&gt;The water data has similar potential.&lt;/p&gt;

&lt;p&gt;Today's simple water active state could eventually become part of more sophisticated anomaly detection.&lt;/p&gt;

&lt;p&gt;And because everything is already inside Home Assistant, those systems don't have to exist as isolated projects.&lt;/p&gt;

&lt;p&gt;They can interact.&lt;/p&gt;

&lt;p&gt;That's ultimately why I wanted the raw meter data locally in the first place:&lt;/p&gt;

&lt;p&gt;Measure locally → understand what the house is doing → automate accordingly.&lt;/p&gt;

&lt;p&gt;Not bad for an ESP32, an RJ12 cable and an afternoon of experimenting.&lt;/p&gt;

&lt;p&gt;Relevant ESPHome configuration&lt;/p&gt;

&lt;p&gt;For reference, this is the core configuration currently running on my ESP32:&lt;/p&gt;

&lt;p&gt;esphome:&lt;br&gt;
  name: p1-meter&lt;br&gt;
  friendly_name: P1 Meter&lt;/p&gt;

&lt;p&gt;esp32:&lt;br&gt;
  board: esp32dev&lt;br&gt;
  framework:&lt;br&gt;
    type: esp-idf&lt;/p&gt;

&lt;p&gt;logger:&lt;br&gt;
  level: DEBUG&lt;/p&gt;

&lt;p&gt;api:&lt;/p&gt;

&lt;p&gt;ota:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;platform: esphome&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;wifi:&lt;br&gt;
  ssid: !secret wifi_ssid&lt;br&gt;
  password: !secret wifi_password&lt;/p&gt;

&lt;p&gt;uart:&lt;br&gt;
  id: p1_uart&lt;br&gt;
  rx_pin:&lt;br&gt;
    number: GPIO16&lt;br&gt;
    inverted: true&lt;br&gt;
  baud_rate: 115200&lt;br&gt;
  rx_buffer_size: 1700&lt;/p&gt;

&lt;p&gt;dsmr:&lt;br&gt;
  uart_id: p1_uart&lt;br&gt;
  max_telegram_length: 1700&lt;br&gt;
  water_mbus_id: 1&lt;/p&gt;

&lt;p&gt;⚠️ Important:&lt;br&gt;
The exact M-Bus IDs and hardware details can differ between installations. This is a description of my working installation, not a universal copy-paste wiring recipe.&lt;/p&gt;

&lt;p&gt;For the software side, ESPHome documents the DSMR component and its available sensors here:&lt;/p&gt;

&lt;p&gt;ESPHome DSMR documentation&lt;/p&gt;

&lt;p&gt;For the Belgian physical P1 interface, use the official specifications rather than relying on cable colours:&lt;/p&gt;

&lt;p&gt;Fluvius P1 technical specifications&lt;/p&gt;

&lt;p&gt;Final thought&lt;/p&gt;

&lt;p&gt;If you're running a Belgian P1 meter with Home Assistant too, I'm particularly interested in what you're doing with the quarter-hour peak and water data.&lt;/p&gt;

&lt;p&gt;Getting the numbers into Home Assistant was the easy part.&lt;/p&gt;

&lt;p&gt;Deciding what useful automations to build from them is the fun part.&lt;/p&gt;

&lt;p&gt;☕ Did this save you some debugging time?&lt;br&gt;
If you'd like to support more write-ups like this, you can buy me a coffee.&lt;br&gt;
&lt;a href="http://buymeacoffee.com/EppieDude" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.buymeacoffee.com%2Fbuttons%2Fdefault-orange.png" alt="Buy Me A Coffee" height="100" width="434"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>homeassistant</category>
      <category>esphome</category>
      <category>esp32</category>
      <category>smarthome</category>
    </item>
  </channel>
</rss>
