Code Monkey home page Code Monkey logo

sml_parser's People

Contributors

crslee avatar cubinet-code avatar deltaphi avatar foorschtbar avatar olliiiver avatar tobsec avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

sml_parser's Issues

ESP32 sending values to Serial.print

Hi @olliiiver,
first of all thanks a lot for providing this SML Parser. I kind of got it running on an ESP32 for reading an ISKRA MT681. When sending the values to the serial, I get pretty strange behaviour. The first 5 digits are the correct kWh of the smart meter and I assume that also some other digits belong the transmitted power. But the length of the value is pretty strange. From translating the HEX value into DEC and using the Scaler 1/10 I know that the transmitted data reads as 11293590,2 Wh. Do you have an idea what might have happened?

dtostrf(MomentanWh, 10, 1, floatBuffer);
Serial.print("Leistung Momentan in Wh: ");
Serial.println(floatBuffer);

Successfully received a complete message!
Wirkenergie Bezug Gesamt in Wh: 112935902000000010225733149127336218953132629394531250000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0

Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x40143fe2 PS : 0x00060030 A0 : 0x800d1465 A1 : 0x3ffb1ab0
A2 : 0x30353231 A3 : 0xffffffff A4 : 0x00000100 A5 : 0x3f400298
A6 : 0x0000000d A7 : 0x00000001 A8 : 0x3ffb1a40 A9 : 0x0000000d
A10 : 0x00e832c0 A11 : 0x3ffb1a40 A12 : 0x00000007 A13 : 0x00000000
A14 : 0x00000007 A15 : 0x3ffb1964 SAR : 0x0000001f EXCCAUSE: 0x0000001c
EXCVADDR: 0x00e832c0 LBEG : 0x400029ac LEND : 0x400029cb LCOUNT : 0x00000000

ELF file SHA256: 0000000000000000

Backtrace: 0x40143fe2:0x3ffb1ab0 0x400d1462:0x3ffb1ad0 0x400d16e1:0x3ffb1b00 0x400d1799:0x3ffb1f50 0x400d32b9:0x3ffb1f70 0x400d1967:0x3ffb1f90 0x400d42f1:0x3ffb1fb0 0x4008985e:0x3ffb1fd0

Rebooting...

Also, I tried to read the current value:
1-0:16.7.0*255 | Wirkleistung in W
by adding the Handler {0x01, 0x00, 0x10, 0x07, 0x00, 0xff}, &LeistungMomentan}, but it only reads -1 and lots of zeros.

Best regards,
Simon

Parsing of the device id (96.1.0)

Hey, unfortunately there is no parser function to parse the device id of an smart meter.

0x01, 0x00, 0x00, 0x00, 0x09, 0xff
96.1.0

Other parsers just print out the raw hex data.
e.g.
Raw SML: 77 07 01 00 60 01 00 FF 01 01 01 01 0B 0A 01 42 51 40 01 05 DC 49 EA 01
Parsed: 0a 01 42 51 40 01 05 dc 49 ea

It would be great because i've two smart meters, one for solar and one for my house.
Having the ID's would help to differentiate them.

Greetings

efr SGM-C2 meter (how to get this working?)

Hello,

I'm trying to get my efr SGM-C2 meter running. Your library looks to receive data and the checksums seams to be ok but I can only make little sense out of the received data. Perhaps you are able to shine some light into it. I attached a bin dump of one package I recorded to check with the native example provided.

Here I found some technical data for the C4 model (could not find info for the C2)
https://www.mit-n.de/fileadmin/user_upload/Dateien/Messwesen/Messwesen_Strom/EFR-SGM-C4-Produkthandbuch.pdf

on Page 33 I found this table:
image

const unsigned char ehz_bin[] = {0x1B,0x1B,0x1B,0x1B,0x01,0x01,0x01,0x01,0x76,0x05,0x01,0x1F,0xF2,0x51,0x62,0x00,0x62,0x00,0x72,0x63,0x01,0x01,0x76,0x01,0x07,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x05,0x00,0x5F,0xFB,0x71,0x0B,0x0A,0x01,0x45,0x46,0x52,0x21,0x01,0xE8,0xB2,0xF0,0x72,0x62,0x01,0x65,0x01,0x08,0xC9,0x7F,0x01,0x63,0x13,0x33,0x00,0x76,0x05,0x01,0x1F,0xF2,0x52,0x62,0x00,0x62,0x00,0x72,0x63,0x07,0x01,0x77,0x07,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x0B,0x0A,0x01,0x45,0x46,0x52,0x21,0x01,0xE8,0xB2,0xF0,0x07,0x01,0x00,0x62,0x0A,0xFF,0xFF,0x72,0x62,0x01,0x65,0x01,0x08,0xC9,0x7F,0x7E,0x77,0x07,0x01,0x00,0x60,0x32,0x01,0x01,0x01,0x01,0x01,0x01,0x04,0x45,0x46,0x52,0x01,0x77,0x07,0x01,0x00,0x60,0x01,0x00,0xFF,0x01,0x01,0x01,0x01,0x0B,0x0A,0x01,0x45,0x46,0x52,0x21,0x01,0xE8,0xB2,0xF0,0x01,0x77,0x07,0x01,0x00,0x01,0x08,0x00,0xFF,0x64,0x04,0x01,0x04,0x72,0x62,0x01,0x65,0x01,0x08,0xC9,0x7F,0x62,0x1E,0x52,0xFF,0x64,0xF5,0x75,0xFA,0x01,0x77,0x07,0x01,0x00,0x02,0x08,0x00,0xFF,0x01,0x72,0x62,0x01,0x65,0x01,0x08,0xC9,0x7F,0x62,0x1E,0x52,0xFF,0x62,0x00,0x01,0x77,0x07,0x01,0x00,0x10,0x07,0x00,0xFF,0x01,0x01,0x62,0x1B,0x52,0x00,0x53,0x00,0x91,0x01,0x77,0x07,0x01,0x00,0x20,0x07,0x00,0xFF,0x01,0x01,0x62,0x23,0x52,0xFF,0x63,0x09,0x05,0x01,0x77,0x07,0x01,0x00,0x1F,0x07,0x00,0xFF,0x01,0x01,0x62,0x21,0x52,0xFE,0x62,0x49,0x01,0x77,0x07,0x01,0x00,0x51,0x07,0x04,0xFF,0x01,0x01,0x62,0x08,0x52,0x00,0x53,0x01,0x4A,0x01,0x77,0x07,0x01,0x00,0x0E,0x07,0x00,0xFF,0x01,0x01,0x62,0x2C,0x52,0xFF,0x63,0x01,0xF4,0x01,0x77,0x07,0x01,0x00,0x00,0x02,0x00,0x00,0x01,0x01,0x01,0x01,0x06,0x30,0x31,0x2E,0x30,0x37,0x01,0x77,0x07,0x01,0x00,0x60,0x5A,0x02,0x01,0x01,0x01,0x01,0x01,0x03,0xA9,0x0A,0x01,0x77,0x07,0x01,0x00,0x61,0x61,0x00,0x00,0x01,0x01,0x01,0x01,0x03,0x00,0x00,0x01,0x77,0x07,0x01,0x00,0x60,0x32,0x01,0x04,0x01,0x01,0x01,0x01,0x09,0x50,0x31,0x2E,0x30,0x33,0x2E,0x30,0x36,0x01,0x77,0x07,0x01,0x00,0x60,0x32,0x04,0x04,0x01,0x01,0x01,0x01,0x03,0x04,0x23,0x01,0x01,0x01,0x63,0x75,0x61,0x00,0x76,0x05,0x01,0x1F,0xF2,0x53,0x62,0x00,0x62,0x00,0x72,0x63,0x02,0x01,0x71,0x01,0x63,0x8A,0x8E,0x00,0x00,0x1B,0x1B,0x1B,0x1B,0x1A,0x01,0x70,0x98};
const unsigned int ehz_bin_len = 416;

I see some obis codes in Data 7 which correspond with the table above but don't get any values:

Executing .pio\build\native\program.exe
START
 LISTSTART on level 1 with 6 nodes
  Data 6 (length = 4): 01 1F F2 51
  Data 5 (length = 1): 00
  Data 4 (length = 1): 00
  LISTSTART on level 2 with 2 nodes
   Data 2 (length = 2): 01 01
   LISTSTART on level 3 with 6 nodes
    Data 6 (empty)
    Data 5 (length = 6): FF FF FF FF FF FF
    Data 4 (length = 4): 00 5F FB 71
    Data 3 (length = 10): 0A 01 45 46 52 21 01 E8 B2 F0
    LISTSTART on level 4 with 2 nodes
     Data 2 (length = 1): 01
     Data 1 (length = 4): 01 08 C9 7F
    LISTEND on level 4
    back to previous list
    Data 1 (empty)
   LISTEND
   back to previous list
  back to previous list
  Data 2 (length = 2): 13 33
 End of block at level 1
 back to previous list
 LISTSTART on level 1 with 6 nodes
  Data 6 (length = 4): 01 1F F2 52
  Data 5 (length = 1): 00
  Data 4 (length = 1): 00
  LISTSTART on level 2 with 2 nodes
   Data 2 (length = 2): 07 01
   LISTSTART on level 3 with 7 nodes
    Data 7 (length = 6): FF FF FF FF FF FF
    Data 6 (length = 10): 0A 01 45 46 52 21 01 E8 B2 F0
    Data 5 (length = 6): 01 00 62 0A FF FF
    LISTSTART on level 4 with 2 nodes
     Data 2 (length = 1): 01
     Data 1 (length = 4): 01 08 C9 7F
    LISTEND on level 4
    back to previous list
    LISTSTART on level 4 with 14 nodes
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6): 01 00 60 32 01 01
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (empty)
      Data 3 (empty)
      Data 2 (length = 3): 45 46 52
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6): 01 00 60 01 00 FF
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (empty)
      Data 3 (empty)
      Data 2 (length = 10): 0A 01 45 46 52 21 01 E8 B2 F0
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6): 01 00 01 08 00 FF
      Data 6 (length = 3): 04 01 04
      LISTSTART on level 6 with 2 nodes
       Data 2 (length = 1): 01
       Data 1 (length = 4): 01 08 C9 7F
      LISTEND on level 6
      back to previous list
      Data 4 (length = 1): 1E
      Data 3 (length = 1): FF
      Data 2 (length = 3): F5 75 FA
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6): 01 00 02 08 00 FF
      Data 6 (empty)
      LISTSTART on level 6 with 2 nodes
       Data 2 (length = 1): 01
       Data 1 (length = 4): 01 08 C9 7F
      LISTEND on level 6
      back to previous list
      Data 4 (length = 1): 1E
      Data 3 (length = 1): FF 
      Data 2 (length = 1): 00
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6): 01 00 10 07 00 FF
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (length = 1): 1B
      Data 3 (length = 1): 00
      Data 2 (length = 2): 00 91
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6): 01 00 20 07 00 FF
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (length = 1): 23
      Data 3 (length = 1): FF
      Data 2 (length = 2): 09 05
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6): 01 00 1F 07 00 FF
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (length = 1): 21
      Data 3 (length = 1): FE
      Data 2 (length = 1): 49
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6): 01 00 51 07 04 FF
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (length = 1): 08
      Data 3 (length = 1): 00
      Data 2 (length = 2): 01 4A
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6): 01 00 0E 07 00 FF
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (length = 1): 2C
      Data 3 (length = 1): FF
      Data 2 (length = 2): 01 F4
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6): 01 00 00 02 00 00
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (empty)
      Data 3 (empty)
      Data 2 (length = 5): 30 31 2E 30 37
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6): 01 00 60 5A 02 01
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (empty)
      Data 3 (empty)
      Data 2 (length = 2): A9 0A
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6): 01 00 61 61 00 00
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (empty)
      Data 3 (empty)
      Data 2 (length = 2): 00 00
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6): 01 00 60 32 01 04
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (empty)
      Data 3 (empty)
      Data 2 (length = 8): 50 31 2E 30 33 2E 30 36
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6): 01 00 60 32 04 04
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (empty)
      Data 3 (empty)
      Data 2 (length = 2): 04 23
      Data 1 (empty)
     LISTEND
     back to previous list
    back to previous list
    Data 2 (empty)
    Data 1 (empty)
   LISTEND
   back to previous list
  back to previous list
  Data 2 (length = 2): 75 61
 End of block at level 1
 back to previous list
 LISTSTART on level 1 with 6 nodes
  Data 6 (length = 4): 01 1F F2 53
  Data 5 (length = 1): 00
  Data 4 (length = 1): 00
  LISTSTART on level 2 with 2 nodes
   Data 2 (length = 2): 02 01
   LISTSTART on level 3 with 1 nodes
    Data 1 (empty)
   LISTEND
   back to previous list
  back to previous list
  Data 2 (length = 2): 8A 8E
 End of block at level 1
 back to previous list
End of block at level 0
Received checksum: 9870
Calculated checksum: 9870
>>> FINAL! Checksum OK
>>> Manufacturer.............:
>>> Power T1    (1-0:1.8.1)..: -3.000 kWh
>>> Power T1+T2 (1-0:1.8.0)..: -3.000 kWh

any help highly appreciated! As we are all these days I'm interested in the power and energy values. Line 3-15 but the others could be useful too ;)

Greetings from Berlin.
Chris

TL Byte "0xFx" doesn't work

Hello,
I have a efr SGM-C4-4A920L meter with the attached SML dump.
Inside this SLM message it starts a new list with extended length (F1+06).
It seems, that this situation is not covered at the moment.

Best regards
Rainer
ehz_bin.zip

esp32_lora: build errors

I had two compile and link errors during build, this is how I resolved:

  1. 'LMIC_UNUSED_PIN' was not declared in this scope:
    add include for u1_t type in file src/hal/hal.h, after line 15 (see commit at [https://github.com/mcci-catena/arduino-lmic/commit/5bcd2469d3d2c1fae5659a3de249cb31e9121891]):

    #include "lmic/oslmic_types.h"

  2. multiple definition of hal_init:
    adding -D hal_init=LMICHAL_init to the build_flags in the platformio.ini file (see issue #41 at [https://github.com/lnlp/LMIC-node/issues/41#issuecomment-1112346011])

possible overflow bugs

sml_parser/src/sml.cpp

Lines 90 to 93 in ca76a0a

if (currentLevel < MAX_TREE_SIZE)
currentLevel++;
nodes[currentLevel] = size;
SML_TREELOG(currentLevel, "LISTSTART on level %i with %i nodes\n",

Suppose currentLevel = MAX_TREE_SIZE - 1 at Line 90. Then, currentLevel = MAX_TREE_SIZE at Line 92, which leads to the following overflow bug.

==269918==ERROR: AddressSanitizer: global-buffer-overflow on address 0x000000f11e4a at pc 0x000000558309 bp 0x7ffde1d4abf0 sp 0x7ffde1d4abe8
WRITE of size 1 at 0x000000f11e4a thread T0
    #0 0x558308 in smlNewList(unsigned char) /home/parallels/sml_parser/src/sml.cpp:92:23
    #1 0x558637 in checkMagicByte(unsigned char&) /home/parallels/sml_parser/src/sml.cpp:118:5
    #2 0x559c52 in smlState(unsigned char&) /home/parallels/sml_parser/src/sml.cpp:292:5

Pass by reference

This lib makes heavy use of pass by reference, even where it is not necessary or even counterproductive.
For example since smlState expects a unsigned char & one can not do something like currentState = smlState(Serial.read()).
I don't think passing by reference of primitive types like char has any performance advantages, on the contrary it is probably even slower than just passing by value since the address is bigger than the value.
If you really want to pass by reference here you should make it const unsigned char & to avoid having to read the bytes into a variable befor passing to smlState.

Support for negative values

In #6 I proposed a code change that would let the SML parser correctly handle negative values for two-byte values. In #6 (comment), it was suggested that #7 should actually cover this issue. Unfortunately, quite the opposite is true: the code does now realiably not handle negative values for any length of data item. Instead of something like -230 I now get 65xxx - resulting in my code telling me that apparently my solar panel consumes 65kW instead of producing a couple 100 watts.

The change proposed in #6 relied on telling the compiler about the actual data type of the data being parsed and then leaving the conversion handling (in this case: Sign extension, possibly twos' complement converion) to the data type conversion of the compiler. The code from #7 removes all of that information and simply pastes the bit pattern received via SML to a long long int.

Switching on the length of the data item being received would be a rather simple approach to implement this. But seeing as this was just removed - what would be the most fitting approach to fix this? If it is only about removing duplicate code, I can try to whip up some template code that should reduce this - although that might not work on every compiler this code passes through.

Smart Meter DWS7420.2.G2 not triggering handlers, unexpected bytes

Hi,

I have a DWS7420.2.G2 from DZG Metering GmbH I'm trying to read with sml_parser on an ESP32.

PXL_20231110_142040212

From the IR Sensor I can properly read SML_START, SML_LISTEND, and SML_FINAL states. However, none of the defined handlers are called. Also, SML_UNEXPECTED occurs, with unexpected values being A6, 78, B4, ... (it changes every reboot).

Any idea how I could debug this?

#define SERIAL_BAUDRATE 9600

#include <sml.h>

unsigned int iHandler = 0;

typedef struct {
  const unsigned char OBIS[6];
  void (*Handler)(); 
} OBISHandler;

void Manufacturer() {
  Serial.println("Manufacturer");
}

void PowerT1() {
  Serial.println("PowerT1");
}

void PowerT2() {
  Serial.println("PowerT2");
}

void PowerSum() {
  Serial.println("PowerSum");
}

void PowerW() {
  Serial.println("PowerW");
}

OBISHandler OBISHandlers[] = {
  {{ 0x81, 0x81, 0xc7, 0x82, 0x03, 0xff }, &Manufacturer},  //   129-129:199.130.3255
  {{ 0x01, 0x00, 0x01, 0x08, 0x00, 0xff }, &PowerSum},     //   1-  0:  1.  8.0*255 (T1+T2)
  {{ 0x01, 0x00, 0x01, 0x08, 0x01, 0xff }, &PowerT1},      //   1-  0:  1.  8.1*255 (T1)
  {{ 0x01, 0x00, 0x01, 0x08, 0x02, 0xff }, &PowerT2},      //   1-  0:  1.  8.2*255 (T2)
  {{ 0x01, 0x00, 0x0F, 0x07, 0x00, 0xff }, &PowerW},       //   1-  15: 7.  7.2*255 (Watt)
  {{ 0, 0 }}
};

void readSMLByte (unsigned char c) {
    sml_states_t s = smlState(c);
    if (s == SML_START) {
      Serial.println("SML_START");
    }
    if (s == SML_LISTEND) {
      Serial.println("SML_LISTEND");
      // check handlers on last received list
      for (iHandler = 0; OBISHandlers[iHandler].Handler != 0 &&
                          !(smlOBISCheck(OBISHandlers[iHandler].OBIS));
            iHandler++);
      if (OBISHandlers[iHandler].Handler != 0) {
        OBISHandlers[iHandler].Handler();
      }
    }
    if (s == SML_UNEXPECTED) {
      Serial.printf("Unexpected byte! >%02X<!\n", c);
    }
    if (s == SML_FINAL) {
      Serial.println("SML_FINAL");
    }
}

void setup() {
  Serial.begin(SERIAL_BAUDRATE);
}

void loop() {
  if (Serial.available() > 0) {
    readSMLByte(Serial.read());
  }
}

esp32_lora: provide example for new HELTEC LoRa32 v3

Thank you for your efforts.
You provide an example for a HELTEC LoRa32 v2 device using LMIC library.
In the meantime a v3 device is out with other CPU (ESP32-S3) and other LoRa chip (SX1262) . The LMIC-lib is outdated and does (currently) not work with this device.
The Heltec WiFi Kit Series (V0.0.7) [https://github.com/Heltec-Aaron-Lee/WiFi_Kit_series/releases/tag/0.0.7] (Basetype: LoRaMac-node) is (currently) the only working environment.
PLS provide an updated example for the new version of the HELTEC LoRa32 board.

Possible integration for ST STM32 CubeIDE ?

Hey i found your SML Parser from volkszaehler. I am experimenting with a stm32 (seeed E5) and try to implement your parser.
Did you try something else before? Any hints?

Got some problems with the C++ integration in C (header file), not that familiar with stm32 at all, just at beginning. Could it be interesting if i can find a implementation for this?

grafik

reading ISKRA MT 681 fails

First: great work on the parser! It's just what I was looking for.

I have an ISKRA MT681 and can't get the parser to produce meaningfull output.
With my own device, I am struggeling to read in the data correctly since I get CRC errors - although the data does look ok and I managed to decode Wh value by hand and it checks out.

Now I startet to use sample data from here, see file below.

CRC checks out and message is parsed correctly but I get strange data back.
For example for the manufacturer code I can see "ISK" in the data, but I get "c" as output.

As far as I understood your code and was able to debug it, there seems to be an offset in the list position when I call the handlers (smlOBISManufacturer) as per your examples.

Would you mind checking the sample data?

(I am new to github, so please give me a hint if the information given is not sufficient.)

edl21example.zip

I hestitated to upload the sample data of my device since I noticed the public key is masked in your sample data. However, if I would do that, I suspect it's hard to debug the CRC issue?

Generate OBISHandlers dynamically

Hi, im trying to Generate the OBIS Handlers dynamically to switch between different smart meter types.
Is there a working solution to achive this?
Ive spend a lot of time figuring out how to get the data dynamic but with no succsess :/

OBISHandler OBISHandlers[] = {
{{ 0x81, 0x81, 0xc7, 0x82, 0x03, 0xff }, &Manufacturer}, /* 129-129:199.130.3255 /
{{ 0x01, 0x00, 0x01, 0x08, 0x01, 0xff }, &PowerT1}, /
1- 0: 1. 8.1
255 (T1) /
{{ 0x01, 0x00, 0x01, 0x08, 0x00, 0xff }, &PowerSum}, /
1- 0: 1. 8.0255 (T1 + T2) /
{{ 0x01, 0x00, 0x0F, 0x07, 0x00, 0xff }, &PowerW}, /
1- 0: 15. 7.0
255 (Watt) */
{{ 0, 0 }}
};

printing out all obis data without knowing them previously

Hi,

thanks for that great lib. Worked out-of-the-box with my MT691.

I'd like to use your lib for a generic SML-to-KNX device (https://github.com/OpenKNX).
For that, I would like to implement something like a "info" mode, where all transmitted OBIS data with their values are displayed.
Then, the user can configure the needed datapoints and how to forward etc...

What would you recommend to do here?
just check if there is a 7node-list which starts with a 6byte octet looking like a OBIS number?
that would be my first "dirty hack" idea...

Hangs with Unexpected byte! Message

I wanted to try out the arduino example (Continuously loops through a static message from RAM and outputs information)
The example compiled fine.
When I used my own counter data from my Holley DTZ541 ZECA I was not able to get any valid data.
I already checked the CRC of my own data. The data are valid.

The unexpected byte! Message beginns at 0xf1,0x06,0x77,0x07,0x01,0x00 (after 106 bytes)

When I use my IR-Sensor with other software like https://github.com/mhop/fhem-mirror/blob/master/fhem/FHEM/47_OBIS.pm all data are extracted fine.

Here is my version of ehz_bin.h

// clang-format off
// Formatted example data from https://github.com/devZer0/libsml-testing

const unsigned char ehz_bin[] = {
0x1b,0x1b,0x1b,0x1b,0x01,0x01,0x01,0x01,0x76,0x04,0x00,0x00,0x01,0x62,0x00,0x62,
0x00,0x72,0x65,0x00,0x00,0x01,0x01,0x76,0x01,0x01,0x07,0x00,0x00,0x00,0x12,0x9c,
0x06,0x0b,0x0a,0x01,0x48,0x4c,0x59,0x02,0x00,0x15,0xb8,0xaa,0x72,0x62,0x01,0x65,
0x00,0x12,0x9c,0x06,0x01,0x63,0xa9,0xae,0x00,0x76,0x04,0x00,0x00,0x02,0x62,0x00,
0x62,0x00,0x72,0x65,0x00,0x00,0x07,0x01,0x77,0x07,0xff,0xff,0xff,0xff,0xff,0xff,
0x0b,0x0a,0x01,0x48,0x4c,0x59,0x02,0x00,0x15,0xb8,0xaa,0x07,0x01,0x00,0x62,0x0a,
0xff,0xff,0x72,0x62,0x01,0x65,0x00,0x12,0x9c,0x06,0xf1,0x06,0x77,0x07,0x01,0x00,
0x60,0x32,0x01,0x01,0x01,0x01,0x01,0x01,0x04,0x48,0x4c,0x59,0x01,0x77,0x07,0x01,
0x00,0x60,0x01,0x00,0xff,0x01,0x01,0x01,0x01,0x0b,0x0a,0x01,0x48,0x4c,0x59,0x02,
0x00,0x15,0xb8,0xaa,0x01,0x77,0x07,0x01,0x00,0x01,0x08,0x00,0xff,0x65,0x00,0x1c,
0x91,0x04,0x72,0x62,0x01,0x65,0x00,0x12,0x9c,0x06,0x62,0x1e,0x52,0xff,0x65,0x00,
0x13,0xe9,0x89,0x01,0x77,0x07,0x01,0x00,0x02,0x08,0x00,0xff,0x01,0x72,0x62,0x01,
0x65,0x00,0x12,0x9c,0x06,0x62,0x1e,0x52,0xff,0x63,0x06,0x3b,0x01,0x77,0x07,0x01,
0x00,0x10,0x07,0x00,0xff,0x01,0x01,0x62,0x1b,0x52,0x00,0x52,0x22,0x01,0x77,0x07,
0x01,0x00,0x24,0x07,0x00,0xff,0x01,0x01,0x62,0x1b,0x52,0x00,0x52,0x89,0x01,0x77,
0x07,0x01,0x00,0x38,0x07,0x00,0xff,0x01,0x01,0x62,0x1b,0x52,0x00,0x52,0x3e,0x01,
0x77,0x07,0x01,0x00,0x4c,0x07,0x00,0xff,0x01,0x01,0x62,0x1b,0x52,0x00,0x52,0x5b,
0x01,0x77,0x07,0x01,0x00,0x20,0x07,0x00,0xff,0x01,0x01,0x62,0x23,0x52,0xff,0x63,
0x09,0x3d,0x01,0x77,0x07,0x01,0x00,0x34,0x07,0x00,0xff,0x01,0x01,0x62,0x23,0x52,
0xff,0x63,0x09,0x46,0x01,0x77,0x07,0x01,0x00,0x48,0x07,0x00,0xff,0x01,0x01,0x62,
0x23,0x52,0xff,0x63,0x09,0x40,0x01,0x77,0x07,0x01,0x00,0x1f,0x07,0x00,0xff,0x01,
0x01,0x62,0x21,0x52,0xfe,0x62,0x45,0x01,0x77,0x07,0x01,0x00,0x33,0x07,0x00,0xff,
0x01,0x01,0x62,0x21,0x52,0xfe,0x62,0x30,0x01,0x77,0x07,0x01,0x00,0x47,0x07,0x00,
0xff,0x01,0x01,0x62,0x21,0x52,0xfe,0x62,0x49,0x01,0x77,0x07,0x01,0x00,0x51,0x07,
0x01,0xff,0x01,0x01,0x62,0x08,0x52,0x00,0x53,0x00,0xf0,0x01,0x77,0x07,0x01,0x00,
0x51,0x07,0x02,0xff,0x01,0x01,0x62,0x08,0x52,0x00,0x52,0x78,0x01,0x77,0x07,0x01,
0x00,0x51,0x07,0x04,0xff,0x01,0x01,0x62,0x08,0x52,0x00,0x53,0x00,0xdf,0x01,0x77,
0x07,0x01,0x00,0x51,0x07,0x0f,0xff,0x01,0x01,0x62,0x08,0x52,0x00,0x53,0x01,0x2f,
0x01,0x77,0x07,0x01,0x00,0x51,0x07,0x1a,0xff,0x01,0x01,0x62,0x08,0x52,0x00,0x53,
0x01,0x2d,0x01,0x77,0x07,0x01,0x00,0x0e,0x07,0x00,0xff,0x01,0x01,0x62,0x2c,0x52,
0xff,0x63,0x01,0xf4,0x01,0x77,0x07,0x01,0x00,0x00,0x02,0x00,0x00,0x01,0x01,0x01,
0x01,0x07,0x35,0x30,0x31,0x30,0x30,0x32,0x01,0x77,0x07,0x01,0x00,0x60,0x5a,0x02,
0x01,0x01,0x01,0x01,0x01,0x05,0x36,0x31,0x33,0x39,0x01,0x01,0x01,0x63,0x8b,0xb3,
0x00,0x76,0x04,0x00,0x00,0x03,0x62,0x00,0x62,0x00,0x72,0x65,0x00,0x00,0x02,0x01,
0x71,0x01,0x63,0xe8,0x23,0x00,0x00,0x00,0x1b,0x1b,0x1b,0x1b,0x1a,0x02,0xed,0xd4
};
const unsigned int ehz_bin_len = 560;

Multiple parsers on one ESP?

Hi, great work, I have this successfully running on an ESP32-C3 for a while now, thanks a lot!
For a new project, I would like to read two meters, and with one SoftSerial and Serial2, this does not seem to be an issue for a single ESP32.
Do I see correctly that this is not possible with library due to the static state variables?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.