olliiiver/sml_parser

TL Byte "0xFx" doesn't work

Closed this issue · 7 comments

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

For me it works now, it was a 50cm Problem. For me it works now 🥇 . Thanks olliiiver!

Thanks both. I'm working on it and found a solution for extended lists.

START
 LISTSTART on level 1 with 6 nodes
  Data 6 (length = 4, octet string): 03 E3 BF 48
  Data 5 (length = 1, unsigned int): 00
  Data 4 (length = 1, unsigned int): 00
  LISTSTART on level 2 with 2 nodes
   Data 2 (length = 2, unsigned int): 01 01
   LISTSTART on level 3 with 6 nodes
    Data 6 (empty)
    Data 5 (length = 6, octet string): FF FF FF FF FF FF
    Data 4 (length = 4, octet string): 01 4B EA 6E
    Data 3 (length = 10, octet string): 0A 01 45 46 52 20 02 CD 98 EA
    LISTSTART on level 4 with 2 nodes
     Data 2 (length = 1, unsigned int): 01
     Data 1 (length = 4, unsigned int): 03 C1 36 67
    LISTEND on level 4
    back to previous list
    Data 1 (empty)
   LISTEND
   back to previous list
  back to previous list
  Data 2 (length = 2, unsigned int): 8F 86
 End of block at level 1
 back to previous list
 LISTSTART on level 1 with 6 nodes
  Data 6 (length = 4, octet string): 03 E3 BF 49
  Data 5 (length = 1, unsigned int): 00
  Data 4 (length = 1, unsigned int): 00
  LISTSTART on level 2 with 2 nodes
   Data 2 (length = 2, unsigned int): 07 01
   LISTSTART on level 3 with 7 nodes
    Data 7 (length = 6, octet string): FF FF FF FF FF FF
    Data 6 (length = 10, octet string): 0A 01 45 46 52 20 02 CD 98 EA
    Data 5 (length = 6, octet string): 01 00 62 0A FF FF
    LISTSTART on level 4 with 2 nodes
     Data 2 (length = 1, unsigned int): 01
     Data 1 (length = 4, unsigned int): 03 C1 36 67
    LISTEND on level 4
    back to previous list
    EXTENDED LISTSTART on level 4 with 22 nodes
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6, octet string): 01 00 60 32 01 01
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (empty)
      Data 3 (empty)
      Data 2 (length = 3, octet string): 45 46 52
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6, octet string): 01 00 60 01 00 FF
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (empty)
      Data 3 (empty)
      Data 2 (length = 10, octet string): 0A 01 45 46 52 20 02 CD 98 EA
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6, octet string): 01 00 01 08 00 FF
      Data 6 (length = 3, unsigned int): 1C 00 04
      LISTSTART on level 6 with 2 nodes
       Data 2 (length = 1, unsigned int): 01
       Data 1 (length = 4, unsigned int): 03 C1 36 67
      LISTEND on level 6
      back to previous list
      Data 4 (length = 1, unsigned int): 1E
      Data 3 (length = 1, signed int): FF
      Data 2 (length = 4, unsigned int): 04 A7 9B 5C
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6, octet string): 01 00 02 08 00 FF
      Data 6 (empty)
      LISTSTART on level 6 with 2 nodes
       Data 2 (length = 1, unsigned int): 01
       Data 1 (length = 4, unsigned int): 03 C1 36 67
      LISTEND on level 6
      back to previous list
      Data 4 (length = 1, unsigned int): 1E
      Data 3 (length = 1, signed int): FF
      Data 2 (length = 4, unsigned int): 03 DD C7 83
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6, octet string): 01 00 10 07 00 FF
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (length = 1, unsigned int): 1B
      Data 3 (length = 1, signed int): 00
      Data 2 (length = 2, signed int): 00 BB
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6, octet string): 01 00 20 07 00 FF
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (length = 1, unsigned int): 23
      Data 3 (length = 1, signed int): FF
      Data 2 (length = 2, unsigned int): 08 DD
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6, octet string): 01 00 34 07 00 FF
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (length = 1, unsigned int): 23
      Data 3 (length = 1, signed int): FF
      Data 2 (length = 2, unsigned int): 08 D9
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6, octet string): 01 00 48 07 00 FF
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (length = 1, unsigned int): 23
      Data 3 (length = 1, signed int): FF
      Data 2 (length = 2, unsigned int): 08 C2
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6, octet string): 01 00 1F 07 00 FF
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (length = 1, unsigned int): 21
      Data 3 (length = 1, signed int): FE
      Data 2 (length = 1, unsigned int): 44
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6, octet string): 01 00 33 07 00 FF
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (length = 1, unsigned int): 21
      Data 3 (length = 1, signed int): FE
      Data 2 (length = 1, unsigned int): 4B
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6, octet string): 01 00 47 07 00 FF
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (length = 1, unsigned int): 21
      Data 3 (length = 1, signed int): FE
      Data 2 (length = 1, unsigned int): 0B
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6, octet string): 01 00 51 07 01 FF
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (length = 1, unsigned int): 08
      Data 3 (length = 1, signed int): 00
      Data 2 (length = 1, signed int): 77
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6, octet string): 01 00 51 07 02 FF
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (length = 1, unsigned int): 08
      Data 3 (length = 1, signed int): 00
      Data 2 (length = 2, signed int): 00 EE
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6, octet string): 01 00 51 07 04 FF
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (length = 1, unsigned int): 08
      Data 3 (length = 1, signed int): 00
      Data 2 (length = 2, signed int): 01 35
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6, octet string): 01 00 51 07 0F FF
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (length = 1, unsigned int): 08
      Data 3 (length = 1, signed int): 00
      Data 2 (length = 2, signed int): 01 40
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6, octet string): 01 00 51 07 1A FF
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (length = 1, unsigned int): 08
      Data 3 (length = 1, signed int): 00
      Data 2 (length = 2, signed int): 01 2B
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6, octet string): 01 00 0E 07 00 FF
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (length = 1, unsigned int): 2C
      Data 3 (length = 1, signed int): FF
      Data 2 (length = 2, unsigned int): 01 F4
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6, octet string): 01 00 00 02 00 00
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (empty)
      Data 3 (empty)
      Data 2 (length = 5, octet string): 30 33 2E 30 30
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6, octet string): 01 00 60 5A 02 01
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (empty)
      Data 3 (empty)
      Data 2 (length = 2, octet string): 42 BD
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6, octet string): 01 00 61 61 00 00
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (empty)
      Data 3 (empty)
      Data 2 (length = 2, octet string): 00 00
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6, octet string): 01 00 60 32 01 04
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (empty)
      Data 3 (empty)
      Data 2 (length = 7, octet string): 50 31 2E 32 2E 31 32
      Data 1 (empty)
     LISTEND
     back to previous list
     LISTSTART on level 5 with 7 nodes
      Data 7 (length = 6, octet string): 01 00 60 32 04 04
      Data 6 (empty)
      Data 5 (empty)
      Data 4 (empty)
      Data 3 (empty)
      Data 2 (length = 2, octet string): 04 22
      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, unsigned int): 67 52
 End of block at level 1
 back to previous list
 LISTSTART on level 1 with 6 nodes
  Data 6 (length = 4, octet string): 03 E3 BF 4A
  Data 5 (length = 1, unsigned int): 00
  Data 4 (length = 1, unsigned int): 00
  LISTSTART on level 2 with 2 nodes
   Data 2 (length = 2, unsigned int): 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, unsigned int): D0 47
 End of block at level 1
 back to previous list
Received checksum: 8DE0
Calculated checksum: 8DE0
>>> FINAL! Checksum OK
>>> Manufacturer.............:
>>> Power T1    (1-0:1.8.1)..: -3.000 Wh
>>> Power T1+T2 (1-0:1.8.0)..: 7809314.800 Wh

Hello @olliiiver
Thank you for caring about this issue.
I had a short look to your changes and there is space for improvements in my point of view.
Now it should work only for lists <32. If the extended list starts with F2, it will not work.
Maybe there is no device outside what has this number of lists, but it is allowed by the SML standard...

Rainer

Hello @olliiiver
First of all, thank you for your great work.
I have a similar problem: If I run your library on the electricity meter with the reduced data set, everything works fine. However, if I switch to the extended data set at the electricity meter, I also get more data from the meter, but then the evaluation of the SML jump always breaks off, see the following list. I already use your library for the extended data set.

Do you have any idea what the problem could be?

Tobs

START
  LISTSTART on level 1 with 6 nodes
    Data 6 (length = 8, octet string): F1 97 00 00 05 EB 1E FC   
    Data 5 (length = 1, unsigned int): 00   
    Data 4 (length = 1, unsigned int): 00   
    LISTSTART on level 2 with 2 nodes
      Data 2 (length = 4, unsigned int): 00 00 01 01    
      LISTSTART on level 3 with 6 nodes
        Data 6 (empty)
        Data 5 (empty)
        Data 4 (length = 4, octet string): 04 29 3E AC     
        Data 3 (length = 10, octet string): 0A 01 4B 46 4D 00 00 00 61 76     
        LISTSTART on level 4 with 2 nodes
          Data 2 (length = 1, unsigned int): 01      
          Data 1 (length = 4, unsigned int): 04 29 3E AC     
        LISTEND on level 4
        back to previous list
      Data 1 (length = 1, unsigned int): 01    LISTEND on level 3
      back to previous list
    back to previous list
    Data 2 (length = 2, unsigned int): AA 16  End of block at level 1
    back to previous list
  LISTSTART on level 1 with 6 nodes
  Data 6 (length = 8, octet string): F1 97 00 00 05 EB 1E FD   
  Data 5 (length = 1, unsigned int): 00   
  Data 4 (length = 1, unsigned int): 00   
  LISTSTART on level 2 with 2 nodes
    Data 2 (length = 4, unsigned int): 00 00 07 01    
    LISTSTART on level 3 with 7 nodes
      Data 7 (empty)
      Data 6 (length = 10, octet string): 0A 01 4B 46 4D 00 00 00 61 76     
      Data 5 (length = 6, octet string): 01 00 62 0A FF FF     
      LISTSTART on level 4 with 2 nodes
        Data 2 (length = 1, unsigned int): 01      
        Data 1 (length = 4, unsigned int): 04 29 3E AC     
      LISTEND on level 4
      back to previous list
      LISTSTART on level 4 with 19 nodes
        LISTSTART on level 5 with 7 nodes
          Data 7 (length = 6, octet string): 01 00 60 32 01 01       
          Data 6 (empty)
          Data 5 (empty)
          Data 4 (empty)
          Data 3 (empty)
          Data 2 (length = 3, octet string): 4B 46 3D       
          Data 1 (empty)
        LISTEND
        back to previous list
        LISTSTART on level 5 with 7 nodes
          Data 7 (length = 6, octet string): 01 00 60 01 00 FF       
          Data 6 (empty)
          Data 5 (empty)
          Data 4 (empty)
          Data 3 (empty)
          Data 2 (length = 10, octet string): 0A 01 4B 46 4D 00 00 00 62 76       
          Data 1 (empty)
        LISTEND
        back to previous list
        LISTSTART on level 5 with 7 nodes
          Data 7 (length = 6, octet string): 01 00 01 08 00 FF       
          Data 6 (length = 4, unsigned int): 00 1C 01 04       
          Data 5 (empty)
          Data 4 (length = 1, unsigned int): 1E       
          Data 3 (length = 1, signed int): FF       
          Data 2 (length = 8, unsigned int): 00 00 00 00 02 A2 B7 9A       
          Data 1 (empty)
        LISTEND
        back to previous list
        LISTSTART on level 5 with 7 nodes
          Data 7 (length = 6, octet string): 01 00 02 08 00 FF       
          Data 6 (empty)
          Data 5 (empty)
          Data 4 (length = 1, unsigned int): 1E       
          Data 3 (length = 1, signed int): FF       
          Data 2 (length = 8, unsigned int): 00 00 00 00 00 05 3D DF       
          Data 1 (empty)
        LISTEND
        back to previous list
        LISTSTART on level 5 with 7 nodes
          Data 7 (length = 6, octet string): 01 00 10 07 00 FF       
          Data 6 (empty)
          Data 5 (empty)
          Data 4 (length = 1, unsigned int): 1B       
          Data 3 (length = 1, signed int): 00       
          Data 2 (length = 8, signed int): 00 00 00 00 00 00 01 11       
          Data 1 (empty)
        LISTEND
        back to previous list
        LISTSTART on level 5 with 7 nodes
          Data 7 (length = 6, octet string): 01 00 20 07 00 FF       
          Data 6 (empty)
          Data 5 (empty)
          Data 4 (length = 1, unsigned int): 23       
          Data 3 (length = 1, signed int): FF       
          Data 2 (length = 8, unsigned int): 00 00 00 00 00 00 09 28       
          Data 1 (empty)
        LISTEND
        back to previous list
        LISTSTART on level 5 with 7 nodes
          Data 7 (length = 6, octet string): 01 00 34 07 00 FF       
          Data 6 (empty)
          Data 5 (empty)
          Data 4 (length = 1, unsigned int): 23       
          Data 3 (length = 1, signed int): FF       
          Data 2 (length = 8, unsigned int): 00 00 00 00 00 00 09 2F       
          Data 1 (empty)
        LISTEND
        back to previous list
        LISTSTART on level 5 with 7 nodes
          Data 7 (length = 6, octet string): 01 00 48 07 00 FF       
          Data 6 (empty)
          Data 5 (length = 2): 52 FF       
          Data 4 (length = 8, unsigned int): 00 00 00 00 09 2B 01 77       
          Data 3 (length = 6, octet string): 01 00 1F 07 00 FF       
          Data 2 (empty)
          Data 1 (empty)
        LISTEND
        back to previous list
        Data 11 (length = 1, unsigned int): 21     
        End of block at level 4
        End of block at level 4
        End of block at level 4
        End of block at level 4
        End of block at level 4

          Data 5 (length = 9, signed int): 01 77 07 00 33 07 00 FF 01      
          Data 4 (empty)
          Data 3 (length = 1, unsigned int): 21      
          Data 2 (length = 1, signed int): FE      
          Data 1 (length = 8, unsigned int): 00 00 00 01 77 07 01 00     
        LISTEND on level 4
        back to previous list
        Data 2 (length = 6): 07 00 FF 01 62 21     
        Data 1 (length = 1, signed int): FE    
        LISTEND on level 3
        back to previous list
        back to previous list
        Data 2 (length = 8, unsigned int): 00 00 00 00 00 00 00 25   
        Data 1 (empty)
        LISTEND
    back to previous list
        LISTSTART on level 1 with 7 nodes
          Data 7 (length = 6, octet string): 01 00 51 07 01 FF   
          Data 6 (empty)
          Data 5 (empty)
          Data 4 (length = 1, unsigned int): 08   
          Data 3 (length = 1, signed int): 00   
          Data 2 (length = 8, signed int): 00 00 00 77 77 01 07 02  
  UNEXPECTED magicbyte >FF< at currentLevel 1

Hi @theTobs. Can you send or attach a binary dump from your electricity meter?

Hi @olliiiver,
after I deactivated the debug mode, it worked and I could receive a complete SML message with the extended data set. Unfortunately I have no idea why it does not work with active debug mode.Enclosed the retrieved data from the electricity meter.

LogFile_bin.txt

Hi @jahnra / Rainer. Would it be OK for you if I add your meter data ( ehz_bin.zip ) to the unit tests for this library?