# Smartmeter no data

**URL:** <https://forum.arduino.cc/t/smartmeter-no-data/1316148>\
**Category:** Home Automation\
**Created:** [October 28, 2024, 5:35pm UTC](https://forum.arduino.cc/t/smartmeter-no-data/1316148 "2024-10-28T17:35:37Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![Human82](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/human82/32/1098783_2.png) [@Human82](https://forum.arduino.cc/u/Human82)\
**Post date:** [October 28, 2024, 5:35pm UTC](https://forum.arduino.cc/t/smartmeter-no-data/1316148/1 "2024-10-28T17:35:37Z")

</div>

Hi, im trying to read my smart meter. Im using an esp8266. Used this to wire things up [https://raw.githubusercontent.com/daniel-jong/esp8266\_p1meter/master/assets/esp8266\_p1meter\_bb.png](https://raw.githubusercontent.com/daniel-jong/esp8266_p1meter/master/assets/esp8266_p1meter_bb.png)

And with this code:

```arduino
/*
 * Permission is hereby granted, free of charge, to anyone
 * obtaining a copy of this document and accompanying files,
 * to do whatever they want with them without any restriction,
 * including, but not limited to, copying, modification and redistribution.
 * NO WARRANTY OF ANY KIND IS PROVIDED.
 *
 * Example that shows how to periodically read a P1 message from a
 * serial port and automatically print the result.
*/

#include "dsmr2.h"

/**
 * Define the data we're interested in, as well as the datastructure to
 * hold the parsed data. This list shows all supported fields, remove
 * any fields you are not using from the below list to make the parsing
 * and printing code smaller.
 * Each template argument below results in a field of the same name.
 */
using MyData = ParsedData<
  /* String */ identification
  /* String */ ,p1_version
  /* String */ ,p1_version_be
  /* String */ ,timestamp
  /* String */ ,equipment_id
  /* FixedValue */ ,energy_delivered_tariff1
  /* FixedValue */ ,energy_delivered_tariff2
  /* FixedValue */ ,energy_returned_tariff1
  /* FixedValue */ ,energy_returned_tariff2
  /* String */ ,electricity_tariff
  /* FixedValue */ ,power_delivered
  /* FixedValue */ ,power_returned
  /* FixedValue */ ,electricity_threshold
  /* uint8_t */ ,electricity_switch_position
  /* uint32_t */ ,electricity_failures
  /* uint32_t */ ,electricity_long_failures
  /* String */ ,electricity_failure_log
  /* uint32_t */ ,electricity_sags_l1
  /* uint32_t */ ,electricity_sags_l2
  /* uint32_t */ ,electricity_sags_l3
  /* uint32_t */ ,electricity_swells_l1
  /* uint32_t */ ,electricity_swells_l2
  /* uint32_t */ ,electricity_swells_l3
  /* String */ ,message_short
  /* String */ ,message_long
  /* FixedValue */ ,voltage_l1
  /* FixedValue */ ,voltage_l2
  /* FixedValue */ ,voltage_l3
  /* FixedValue */ ,current_l1
  /* FixedValue */ ,current_l2
  /* FixedValue */ ,current_l3
  /* FixedValue */ ,power_delivered_l1
  /* FixedValue */ ,power_delivered_l2
  /* FixedValue */ ,power_delivered_l3
  /* FixedValue */ ,power_returned_l1
  /* FixedValue */ ,power_returned_l2
  /* FixedValue */ ,power_returned_l3
  /* uint16_t */ ,mbus1_device_type
  /* String */ ,mbus1_equipment_id_tc
  /* String */ ,mbus1_equipment_id_ntc
  /* uint8_t */ ,mbus1_valve_position
  /* TimestampedFixedValue */ ,mbus1_delivered
  /* TimestampedFixedValue */ ,mbus1_delivered_ntc
  /* TimestampedFixedValue */ ,mbus1_delivered_dbl
  /* uint16_t */ ,mbus2_device_type
  /* String */ ,mbus2_equipment_id_tc
  /* String */ ,mbus2_equipment_id_ntc
  /* uint8_t */ ,mbus2_valve_position
  /* TimestampedFixedValue */ ,mbus2_delivered
  /* TimestampedFixedValue */ ,mbus2_delivered_ntc
  /* TimestampedFixedValue */ ,mbus2_delivered_dbl
  /* uint16_t */ ,mbus3_device_type
  /* String */ ,mbus3_equipment_id_tc
  /* String */ ,mbus3_equipment_id_ntc
  /* uint8_t */ ,mbus3_valve_position
  /* TimestampedFixedValue */ ,mbus3_delivered
  /* TimestampedFixedValue */ ,mbus3_delivered_ntc
  /* TimestampedFixedValue */ ,mbus3_delivered_dbl
  /* uint16_t */ ,mbus4_device_type
  /* String */ ,mbus4_equipment_id_tc
  /* String */ ,mbus4_equipment_id_ntc
  /* uint8_t */ ,mbus4_valve_position
  /* TimestampedFixedValue */ ,mbus4_delivered
  /* TimestampedFixedValue */ ,mbus4_delivered_ntc
  /* TimestampedFixedValue */ ,mbus4_delivered_dbl
>;

/**
 * This illustrates looping over all parsed fields using the
 * ParsedData::applyEach method.
 *
 * When passed an instance of this Printer object, applyEach will loop
 * over each field and call Printer::apply, passing a reference to each
 * field in turn. This passes the actual field object, not the field
 * value, so each call to Printer::apply will have a differently typed
 * parameter.
 *
 * For this reason, Printer::apply is a template, resulting in one
 * distinct apply method for each field used. This allows looking up
 * things like Item::name, which is different for every field type,
 * without having to resort to virtual method calls (which result in
 * extra storage usage). The tradeoff is here that there is more code
 * generated (but due to compiler inlining, it's pretty much the same as
 * if you just manually printed all field names and values (with no
 * cost at all if you don't use the Printer).
 */
struct Printer {
  template<typename Item>
  void apply(Item &i) {
    if (i.present()) {
      Serial.print(Item::name);
      Serial.print(F(": "));
      Serial.print(i.val());
      Serial.print(Item::unit());
      Serial.println();
    }
  }
};

// Set up to read from the second serial port, and use D2 as the request
// pin. On boards with only one (USB) serial port, you can also use
// SoftwareSerial.
#ifdef ARDUINO_ARCH_ESP32
// Create Serial1 connected to UART 1
HardwareSerial Serial1(1);
#endif
P1Reader reader(&Serial1, 2);

unsigned long last;

void setup() {
  Serial.begin(115200);
  Serial1.begin(115200);
  delay(250);
  Serial.println("\r\nAnd then it all starts ...\r\n");
  
  #ifdef VCC_ENABLE
  // This is needed on Pinoccio Scout boards to enable the 3V3 pin.
  pinMode(VCC_ENABLE, OUTPUT);
  digitalWrite(VCC_ENABLE, HIGH);
  #endif

  // start a read right away
  reader.enable(true);
  last = millis();
}

void loop () {
  // Allow the reader to check the serial buffer regularly
  reader.loop();

  // Every minute, fire off a one-off reading
  unsigned long now = millis();
  if (now - last > 600) {
    reader.enable(true);
    last = now;
  }

  if (reader.available()) {
    MyData data;
    String err;
    if (reader.parse(&data, &err)) {
      // Parse succesful, print result
      data.applyEach(Printer());
    } else {
      // Parser error, print error
      Serial.println(err);
    }
  }
}

```

For some reason i only see "and then it starts" in my serial monitor. No data seems to com true.

Can someone help me out? TIA!

---

<div class="post-metadata">

**Author:** ![kolaha](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/kolaha/32/966427_2.png) [@kolaha](https://forum.arduino.cc/u/kolaha)\
**Post date:** [October 28, 2024, 5:38pm UTC](https://forum.arduino.cc/t/smartmeter-no-data/1316148/2 "2024-10-28T17:38:51Z")

</div>

did you test simple communication sketch? comes any byte at all?

---

<div class="post-metadata">

**Author:** ![Human82](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/human82/32/1098783_2.png) [@Human82](https://forum.arduino.cc/u/Human82)\
**Post date:** [October 28, 2024, 5:46pm UTC](https://forum.arduino.cc/t/smartmeter-no-data/1316148/3 "2024-10-28T17:46:09Z")

</div>

Did a check baudrate sketch and that shows baudrate is 115200. Wich sketch do u advice?

---

<div class="post-metadata">

**Author:** ![kmin](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/kmin/32/1147370_2.png) [@kmin](https://forum.arduino.cc/u/kmin)\
**Post date:** [October 28, 2024, 5:54pm UTC](https://forum.arduino.cc/t/smartmeter-no-data/1316148/4 "2024-10-28T17:54:23Z")

</div>

> [@Human82](#):
>
> Im using an esp8266.

> [@Human82](#):
>
> ```arduino
> // pin. On boards with only one (USB) serial port, you can also use
> // SoftwareSerial.
> 
> ```

Consider that limitation with Esp8266...

---

<div class="post-metadata">

**Author:** ![kolaha](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/kolaha/32/966427_2.png) [@kolaha](https://forum.arduino.cc/u/kolaha)\
**Post date:** [October 28, 2024, 5:59pm UTC](https://forum.arduino.cc/t/smartmeter-no-data/1316148/5 "2024-10-28T17:59:33Z")

</div>

```arduino
void setup() {
  Serial.begin(115200);
  Serial1.begin(115200);
}
void loop(){
  Serial.print(Serial1.read()); something like this
}

```

---

<div class="post-metadata">

**Author:** ![Human82](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/human82/32/1098783_2.png) [@Human82](https://forum.arduino.cc/u/Human82)\
**Post date:** [October 28, 2024, 6:20pm UTC](https://forum.arduino.cc/t/smartmeter-no-data/1316148/6 "2024-10-28T18:20:12Z")

</div>

this is what i get: -1-1-1....

---

<div class="post-metadata">

**Author:** ![kmin](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/kmin/32/1147370_2.png) [@kmin](https://forum.arduino.cc/u/kmin)\
**Post date:** [October 28, 2024, 9:44pm UTC](https://forum.arduino.cc/t/smartmeter-no-data/1316148/7 "2024-10-28T21:44:34Z")

</div>

Esp8266 doesn't have serial1 RX.  
Your code suggest you to use software serial. But the baud rate might be too high for reliable communication.

---

<div class="post-metadata">

**Author:** ![Human82](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/human82/32/1098783_2.png) [@Human82](https://forum.arduino.cc/u/Human82)\
**Post date:** [October 29, 2024, 8:43am UTC](https://forum.arduino.cc/t/smartmeter-no-data/1316148/8 "2024-10-29T08:43:30Z")

</div>

Never did that. Can you show me how to do this?

---

<div class="post-metadata">

**Author:** ![kmin](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/kmin/32/1147370_2.png) [@kmin](https://forum.arduino.cc/u/kmin)\
**Post date:** [October 29, 2024, 9:25am UTC](https://forum.arduino.cc/t/smartmeter-no-data/1316148/9 "2024-10-29T09:25:45Z")

</div>

You don't have any Esp32 board on hand?

---

<div class="post-metadata">

**Author:** ![Human82](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/human82/32/1098783_2.png) [@Human82](https://forum.arduino.cc/u/Human82)\
**Post date:** [October 29, 2024, 9:34am UTC](https://forum.arduino.cc/t/smartmeter-no-data/1316148/10 "2024-10-29T09:34:13Z")

</div>

Got a esp32 and tried it. But give some errors to...

---

<div class="post-metadata">

**Author:** ![rsmls](https://avatars.discourse-cdn.com/v4/letter/r/5daacb/32.png) [@rsmls](https://forum.arduino.cc/u/rsmls)\
**Post date:** [October 29, 2024, 9:36am UTC](https://forum.arduino.cc/t/smartmeter-no-data/1316148/11 "2024-10-29T09:36:01Z")

</div>

What kind of smart meter? Ours doesn't put out 3V3, nor will it source enough current to reliably power an ESP8266.

---

<div class="post-metadata">

**Author:** ![kmin](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/kmin/32/1147370_2.png) [@kmin](https://forum.arduino.cc/u/kmin)\
**Post date:** [October 29, 2024, 9:59am UTC](https://forum.arduino.cc/t/smartmeter-no-data/1316148/12 "2024-10-29T09:59:18Z")

</div>

> [@Human82](#):
>
> Got a esp32 and tried it. But give some errors to...

You need to change the pin you use for serial Rx  
`HardwareSerial Serial1(18); //Gpio18  
What errors you got?

---

<div class="post-metadata">

**Author:** ![Human82](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/human82/32/1098783_2.png) [@Human82](https://forum.arduino.cc/u/Human82)\
**Post date:** [October 29, 2024, 1:13pm UTC](https://forum.arduino.cc/t/smartmeter-no-data/1316148/13 "2024-10-29T13:13:17Z")

</div>

Sagecom s211

---

<div class="post-metadata">

**Author:** ![Human82](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/human82/32/1098783_2.png) [@Human82](https://forum.arduino.cc/u/Human82)\
**Post date:** [October 29, 2024, 1:13pm UTC](https://forum.arduino.cc/t/smartmeter-no-data/1316148/14 "2024-10-29T13:13:50Z")

</div>

To much to mention...

---

<div class="post-metadata">

**Author:** ![Human82](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/human82/32/1098783_2.png) [@Human82](https://forum.arduino.cc/u/Human82)\
**Post date:** [October 29, 2024, 1:33pm UTC](https://forum.arduino.cc/t/smartmeter-no-data/1316148/15 "2024-10-29T13:33:48Z")

</div>

Getting crazy from this stuff. Tried diffrent ways with different microntrollers. No luck at all...

---

<div class="post-metadata">

**Author:** ![vicccccc](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/vicccccc/32/1153078_2.png) [@vicccccc](https://forum.arduino.cc/u/vicccccc)\
**Post date:** [January 8, 2025, 3:43pm UTC](https://forum.arduino.cc/t/smartmeter-no-data/1316148/16 "2025-01-08T15:43:10Z")

</div>

hello, did you manage to read the data ? I ve the same problem as you

---

<div class="post-metadata">

**Author:** ![Human82](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/human82/32/1098783_2.png) [@Human82](https://forum.arduino.cc/u/Human82)\
**Post date:** [January 10, 2025, 2:07pm UTC](https://forum.arduino.cc/t/smartmeter-no-data/1316148/17 "2025-01-10T14:07:01Z")

</div>

Didn't solve the problem. Used an esp8266 instead. Hope to get some more time to try some more in a few weeks....

---

<div class="post-metadata">

**Author:** ![viorel\_c](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/viorel_c/32/1128388_2.png) [@viorel\_c](https://forum.arduino.cc/u/viorel_c)\
**Post date:** [March 16, 2025, 2:54pm UTC](https://forum.arduino.cc/t/smartmeter-no-data/1316148/18 "2025-03-16T14:54:42Z")

</div>

@vicccccc , @Human82  
Read this:

> [@Hot water analog control via P1 meter XT211 (BE Fluvius) energy meter reading](https://forum.arduino.cc/t/hot-water-analog-control-via-p1-meter-xt211-be-fluvius-energy-meter-reading/1359240/108):
>
> Making progress. Just start looking on different other programs and this works: a5 = data.power\_returned.int\_val(); a6 = data.power\_delivered.int\_val(); cc = a5 + a6; Serial.println(a5); Serial.println(a6); Serial.println(cc); Serial.println(); I will continue and I will let you know later the status. So far, thanks to you all for your kind effort. Highly appreciated.

It may help you to understand the start point.

Get an oscilloscope to see what you have.  
Get a serial to USB cable to read the P1 port via putty (I trust it is opened by now. You have to do that in communication with transport energy company.)

In general, split the problem in smaller projects. Like: first get a record from the string output of P1 port. Before that solved, there is no reason to go further.  
I know, while I've been there.... and still working on my project.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [September 12, 2025, 2:54pm UTC](https://forum.arduino.cc/t/smartmeter-no-data/1316148/19 "2025-09-12T14:54:52Z")

</div>

Closed on September 12, 2025, 2:54pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
