arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
22.23k stars 4.81k forks source link

Add support for IEC 62056 / EN 62056-21 utility meters #8790

Closed ilgrank closed 4 years ago

ilgrank commented 4 years ago

Have you looked for this feature in other issues and in the docs?
yes Is your feature request related to a problem? Please describe.
not related to a problem

Describe the solution you'd like
I would like to be able to read smart Gas/Energy meters using a phototransistor. HopenHAB seems to have a basic implementation already ( https://www.openhab.org/addons/bindings/smartmeter/ ) , but it would be nice to be able to read values directly from Tasmota:

Describe alternatives you've considered
I've tried the code here on Arduino: http://tunn.us/arduino/landisgyr.php

Additional context
A very good protocol analysis/explanation: here A sample of utility meter using the port: http://www.metersit.com/images/pdf/TECHNICAL_DATA_MM.pdf

(Please, remember to close the issue when the problem has been addressed)

gemu2015 commented 1 year ago

meanwhile i changed syntax to pure obis code 1,pm(1.8.1)@1000,kWh_IN,kWh,kWh_IN,3;Wirkenergie Lieferung (+AFF)

i am still waiting for feedback from some users before doing a pr

so fetch latest version here:

https://github.com/gemu2015/Sonoff-Tasmota

gismo2004 commented 1 year ago

Awesome!

Current Config:

>D

>B
smlj=0
=>sensor53 r
>R
smlj=0
>S
if upsecs>22
then
smlj|=1
endif
>M 2
+1,17,r,0,2400,Heizung
1,=so3,512
1,=GUEK
1,pm(1.8.0)@1000,kWh_IN,kWh,kWh_IN,3;Wirkenergie Lieferung (+A)
1,pm(1.8.1)@1000,kWh_IN_T1,kWh,kWh_IN_T1,3;Wirkenergie Lieferung (+A) Tarif 1
1,pm(1.8.2)@1000,kWh_IN_T2,kWh,kWh_IN_T2,3;Wirkenergie Lieferung (+A) Tarif 2
1,pm(1.7.0)@1000,kW_IN,kW,kW_IN,3;Momentane Wirkleistung Lieferung (+A)
;1,pm(2.8.0)@1000,kWh_OUT,kWh,kWh_OUT,3;Wirkenergie Bezug (-A)
;1,pm(2.8.1)@1000,kWh_OUT_T1,kWh,kWh_OUT_T1,3;Wirkenergie Bezug (-A) Tarif 1
;1,pm(2.8.2)@1000,kWh_OUT_T2,kWh,kWh_OUT_T2,3;Wirkenergie Bezug (-A) Tarif 2
;1,pm(2.7.0)@1000,kW_OUT,kW,kW_OUT,3;Momentane Wirkleistung Bezug (-A)
1,pm(3.8.0)@1000,kvarh_IN,kvarh,kvarh_IN,3;Blindenergie Lieferung (+R)
1,pm(3.8.1)@1000,kvarh_IN_T1,kvarh,kvarh_IN_T1,3;Blindenergie Lieferung (+R) Tarif 1
1,pm(3.8.2)@1000,kvarh_IN_T2,kvarh,kvarh_IN_T2,3;Blindenergie Lieferung (+R) Tarif 2
1,pm(3.7.0)@1000,kvar_IN,kvar,kvar_IN,3;Momentane Blindleistung Lieferung (+R)
1,pm(4.8.0)@1000,kvarh_OUT,kvarh,kvarh_OUT,3;Blindenergie Bezug (-R)
1,pm(4.8.1)@1000,kvarh_OUT_T1,kvarh,kvarh_OUT_T1,3;Blindenergie Bezug (-R) Tarif 1
1,pm(4.8.2)@1000,kvarh_OUT_T2,kvarh,kvarh_OUT_T2,3;Blindenergie Bezug (-R) Tarif 2
1,pm(4.7.0)@1000,kvar_OUT,kvar,kvar_OUT,3;Momentane Blindleistung Bezug (-R)

+2,16,r,0,2400,Haus
2,=so3,512
2,=so4,GUEK
2,pm(1.8.0)@1000,kWh_IN,kWh,kWh_IN,3;Wirkenergie Lieferung (+A)
2,pm(1.8.1)@1000,kWh_IN_T1,kWh,kWh_IN_T1,3;Wirkenergie Lieferung (+A) Tarif 1
2,pm(1.8.2)@1000,kWh_IN_T2,kWh,kWh_IN_T2,3;Wirkenergie Lieferung (+A) Tarif 2
2,pm(1.7.0)@1000,kW_IN,kW,kW_IN,3;Momentane Wirkleistung Lieferung (+A)
;2,pm(2.8.0)@1000,kWh_OUT,kWh,kWh_OUT,3;Wirkenergie Bezug (-A)
;2,pm(2.8.1)@1000,kWh_OUT_T1,kWh,kWh_OUT_T1,3;Wirkenergie Bezug (-A) Tarif 1
;2,pm(2.8.2)@1000,kWh_OUT_T2,kWh,kWh_OUT_T2,3;Wirkenergie Bezug (-A) Tarif 2
;2,pm(2.7.0)@1000,kW_OUT,kW,kW_OUT,3;Momentane Wirkleistung Bezug (-A)
2,pm(3.8.0)@1000,kvarh_IN,kvarh,kvarh_IN,3;Blindenergie Lieferung (+R)
2,pm(3.8.1)@1000,kvarh_IN_T1,kvarh,kvarh_IN_T1,3;Blindenergie Lieferung (+R) Tarif 1
2,pm(3.8.2)@1000,kvarh_IN_T2,kvarh,kvarh_IN_T2,3;Blindenergie Lieferung (+R) Tarif 2
2,pm(3.7.0)@1000,kvar_IN,kvar,kvar_IN,3;Momentane Blindleistung Lieferung (+R)
2,pm(4.8.0)@1000,kvarh_OUT,kvarh,kvarh_OUT,3;Blindenergie Bezug (-R)
2,pm(4.8.1)@1000,kvarh_OUT_T1,kvarh,kvarh_OUT_T1,3;Blindenergie Bezug (-R) Tarif 1
2,pm(4.8.2)@1000,kvarh_OUT_T2,kvarh,kvarh_OUT_T2,3;Blindenergie Bezug (-R) Tarif 2
2,pm(4.7.0)@1000,kvar_OUT,kvar,kvar_OUT,3;Momentane Blindleistung Bezug (-R)
#

;Landis+Gyr E450
;https://www.e-netze.at/downloads-data/pdf.aspx?pdf=EN_Update%20Kundenschnittstelle%20Smart%20Meter_ID3282_WEB_RGB.pdf

@australien340 This is for the new config :-) tasmota32.zip

@gemu2015 works for me since I have started here, without any bad readings or other issues! homeassistant

gismo2004 commented 1 year ago

@gemu2015 for some reason, some signals have reported zero overnight. I am quite sure, that this is an error/problem on SmartMeter side, but unfortunately this leads to bad statistics in HomeAssistant. Do you see any chance to prevent reading/sending values lower/higher than xy via “limit” set in signal description line?

1,pm(1.8.0,lowerLim,upperLim)@1000,kWh_IN,kWh,kWh_IN,3;Wirkenergie Lieferung (+A)

image

gemu2015 commented 1 year ago

try setting the median filter (flag = 16) +1,17,r,16,2400,Heizung

m1k3f15h commented 1 year ago

Hello,

I tried do compile @gemu2015 last version of tasmota but with SML but:

c:/users/michael/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\tasmota-sml\libc77\libams.a(han_Parser.cpp.o):(.text._ZN10Han_Parser10unwrapDataEPhR17DataParserContext+0x24): undefined reference to `GCMParser::GCMParser(unsigned char*, unsigned char*)'
c:/users/michael/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\tasmota-sml\libc77\libams.a(han_Parser.cpp.o):(.text._ZN10Han_Parser10unwrapDataEPhR17DataParserContext+0x28): undefined reference to `GCMParser::parse(unsigned char*, DataParserContext&)'
c:/users/michael/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\tasmota-sml\libc77\libams.a(han_Parser.cpp.o): in function `Han_Parser::unwrapData(unsigned char*, DataParserContext&)':
han_Parser.cpp:(.text._ZN10Han_Parser10unwrapDataEPhR17DataParserContext+0x12a): undefined reference to `GCMParser::GCMParser(unsigned char*, unsigned char*)'
c:/users/michael/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: han_Parser.cpp:(.text._ZN10Han_Parser10unwrapDataEPhR17DataParserContext+0x13a): undefined reference to `GCMParser::parse(unsigned char*, DataParserContext&)'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\tasmota-sml\firmware.elf] Error 1

Someone knows about this?

mike

gemu2015 commented 1 year ago

define USE_TLS

or use latest dev from Tasmota

m1k3f15h commented 1 year ago

Thank you @gemu2015 :) compile ok.. now testing :)

m1k3f15h commented 1 year ago

I see now data:

13:17:50.097 decrypted block: 512 bytes 13:17:50.099 :>e6 01 01 68 53 00 00 00 01 67 1b 00 08 53 41 47 13:17:50.101 :>59 05 e9 46 11 01 00 f8 20 00 4d 09 00 23 00 16 13:17:50.103 :>14 00 01 00 18 06 00 6a 09 32 00 06 9d a7 0a 00 13:17:50.105 :>7d 7f b6 a7 43 1b d0 7e 38 1d 00 91 00 1d 00 94 13:17:50.107 :>cb 18 77 e6 5b 55 1c 00 0c 00 3b 00 01 0f 00 32 13:17:50.109 :>8f 0c 00 bc c1 3f 73 2a 00 2f 00 d9 a7 51 cb 2b 13:17:50.112 :>24 3d 58 16 21 37 85 c8 21 f1 62 6e 0b 00 39 fe 13:17:50.114 :>17 13 00 02 00 df 0e 00 3e 13 00 32 0f 03 00 3b 13:17:50.116 :>11 ef 7f 54 25 34 00 07 00 67 29 09 00 4d 36 71 13:17:50.118 :>e9 77 1b e9 55 8f 25 01 00 28 12 00 ef b5 d3 71 13:17:50.120 :>b0 24 d6 1c 00 30 0f 00 0c 3d bc da ef cd 79 01 13:17:50.122 :>00 4e ba 32 00 34 6c 2e a7 3b 04 69 04 00 6a 20 13:17:50.124 :>a1 78 20 00 09 15 00 fd 3e 00 3f 12 10 80 0c 11 13:17:50.126 :>00 01 00 1c 00 3f 01 00 3b 00 72 07 00 51 97 b6 13:17:50.128 :>f7 58 7c b3 7a 10 02 07 00 ba 8f 06 57 ec 0b 00 13:17:50.131 :>77 fd 85 1a 00 0f 00 ae 47 6f 98 02 00 80 38 e0 13:17:50.133 :>33 33 1d 33 01 00 8f 00 00 00 00 00 00 00 00 00 13:17:50.135 :>00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13:17:50.137 :>00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13:17:50.139 :>00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13:17:50.141 :>00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13:17:50.143 :>00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13:17:50.145 :>00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13:17:50.147 :>00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13:17:50.149 :>00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13:17:50.151 :>00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13:17:50.153 :>00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13:17:50.155 :>00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13:17:50.158 :>00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13:17:50.160 :>00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13:17:50.162 :>00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13:17:50.164 :>00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

but i dont know what to write in the script / describer: https://www.netz-noe.at/Download-(1)/Smart-Meter/218_9_SmartMeter_Kundenschnittstelle_lektoriert_14.aspx

@gemu2015 can you give me a hint?

mike

gismo2004 commented 1 year ago

@m1k3f15h --> it's all in the document

This should be "Momentanleistung"

1,pm(2.7.0)@1,W_IN,W,W_IN,3;

Somehow the data seems not to be valid --> not sure if this meter is supported. have you tried to use this: https://github.com/UtilitechAS/amsreader-firmware ?

m1k3f15h commented 1 year ago

Yess this works perfect. But i love tasmota :) Now i have 2 WemosD1 One with the "AmsReader" and one for a Modbus Smartmeter.

My Wish is to integrate the AmsReader in the other Wemos :)

gismo2004 commented 1 year ago

Ok, what is your current config?

gemu2015 commented 1 year ago

switch to console debug mode to see what is decoded in detail

Noschvie commented 1 year ago

@m1k3f15h : Hi Mike, which type of smart meter do you have ? Kaifa MA309 or Sagemcom T210 ?

m1k3f15h commented 1 year ago

@gismo2004 2400 8N1 HAN=UART2

@Noschvie SagemcomT210

@gemu2015:

13:44:53.595 SML: sync 13:44:54.555 SML: MBUS frame: 13:44:54.557 SML: Boundry flag missing 13:44:54.607 SML: Ended up in default case while unwrapping...(tag 3B) 13:44:54.609 SML: Unknown data payload: 13:44:54.656 SML: Ended up in default case while unwrapping...(tag DA) 13:44:54.658 SML: Unknown data payload: 13:44:54.708 SML: Ended up in default case while unwrapping...(tag 72) 13:44:54.710 SML: Unknown data payload: 13:44:54.758 SML: Ended up in default case while unwrapping...(tag AE) 13:44:54.760 SML: Unknown data payload: 13:44:54.810 SML: Ended up in default case while unwrapping...(tag 0D) 13:44:54.812 SML: Unknown data payload: 13:44:54.859 SML: Ended up in default case while unwrapping...(tag 26) 13:44:54.861 SML: Unknown data payload:

m1k3f15h commented 1 year ago

Normaly there shoud be a DataPush every 5 seconds. But i see them verry irregular.. Same MBUS Adapter works with the other software.. only WemosD1 is another one

mike

Noschvie commented 1 year ago

This script works with the Sagemcom T210 / EVN using an ESP32 and "Mikroe M-BUS Slave Click"

>D

>B
=>sensor53 r1

>M 1
+1,16,r,0,2400
1,=so3,512
1,=so4,<<my key>>
1,pm(1.8.0)@1000,Energie Bezug P+,kWh,Wirkenergie.plus,3;
1,pm(2.8.0)@1000,Energie Lieferung P-,kWh,Wirkenergie.minus,3;
1,pm(1.7.0)@1000,aktuelle Leistung P+,kW,Leistung.plus,3;
1,pm(2.7.0)@1000,aktuelle Leistung P-,kW,Leistung.minus,3;
1,pm(31.7.0)@100,Strom Phase L1,A,Strom.L1,3;
1,pm(51.7.0)@100,Strom Phase L2,A,Strom.L2,3;
1,pm(71.7.0)@100,Strom Phase L3,A,Strom.L3,3;
1,pm(32.7.0)@10,Spannung Phase L1,V,Spannung.L1,2;
1,pm(52.7.0)@10,Spannung Phase L2,V,Spannung.L2,2;
1,pm(72.7.0)@10,Spannung Phase L3,V,Spannung.L3,2;
#
m1k3f15h commented 1 year ago

@Noschvie I tried your script with my key

now there is every 5 secondy a entry in the log but no values:

13:52:59.811 SML: MBUS frame: 13:52:59.813 SML: Boundry flag missing 13:52:59.862 SML: Ended up in default case while unwrapping...(tag 06) 13:52:59.864 SML: Unknown data payload: 13:52:59.913 SML: Ended up in default case while unwrapping...(tag FB) 13:52:59.914 SML: Unknown data payload: 13:52:59.963 SML: Ended up in default case while unwrapping...(tag 20) 13:52:59.965 SML: Unknown data payload: 13:53:00.013 SML: Ended up in default case while unwrapping...(tag 6A) 13:53:00.016 SML: Unknown data payload: 13:53:00.064 SML: Ended up in default case while unwrapping...(tag 0D) 13:53:00.066 SML: Unknown data payload: 13:53:00.114 SML: DLMS frame: 13:53:00.116 SML: Unknown data payload:

m1k3f15h commented 1 year ago

is there a suggestion which GPIO i should use?

Noschvie commented 1 year ago

GPIO16 / UART2 RX (ESP32) works fine. Never tested with Wemos D1 mini, but can be done this weekend.

gemu2015 commented 1 year ago

on an esp8266 better use Hardware serial => pin 3. because software serial blocks other processing during receive. you may try to use larger buffers + IRQ buffers 1,=so3,1024,1024

dkneisz commented 1 year ago

Is there an alternative to "Mikroe M-BUS Slave Click" that I can use (preferably one I can order on amazon.de that is shipping to Austria)? I only found "TSS721 Modul M-BUS to TTL" but I'm unable to get that as well. I seem to have no luck with the combination of a NodeMCU v3 and one of these https://www.amazon.de/dp/B083943T9J?psc=1&ref=ppx_yo2ov_dt_b_product_details. There seems to be no signal coming from my Landis+Gyr E450. And yes, it's activated. I can measure around 25V and every 5 sec it drops a little (measured with a multimeter). Either I did wire something wrong or the boards are not usable for this case. Would appreciate any help / tips. Thanks.

Noschvie commented 1 year ago

Hi Dave, have a look at https://www.mouser.at The board of your link doesn't support the M-Bus interface.

dkneisz commented 1 year ago

Hi @Noschvie, I already did, but ordering that will cost me € 20,- for shipping alone. That's why I'm looking for alternatives that I can order locally(-ish).

Noschvie commented 1 year ago

@dkneisz : ok, I have seen... for 4 boards shipping is free, I can take 2 of them...

dkneisz commented 1 year ago

@Noschvie, sorry I just placed an order. I added some other things I (might) need for other projects to get free shipping.

m1k3f15h commented 1 year ago

I tested it with a esp32-cam on GPIO16 And it Works!! I love it :)

Mike

dkneisz commented 1 year ago

I now got my "Mikroe M-BUS Slave Click" boards and wired them up to an ESP32 on ports 16 and 17. So far no joy. I compiled the latest Tasmota/dev myself. I used a custom environment based on "env:tasmota32", that looks like this:

[env:tasmota32-smartmeter]
extends     = env:tasmota32
build_flags = ${env:tasmota32.build_flags}
              -DCUSTOM_SMART_METER

The "CUSTOM_SMART_METER" adds the following via user_config_override.h:

#ifdef CUSTOM_SMART_METER
  #ifndef USE_SCRIPT
    #define USE_SCRIPT
  #endif
  #ifndef USE_SML_M
    #define USE_SML_M
  #endif
  #ifdef USE_RULES
    #undef USE_RULES
  #endif
#endif

In my script I configured this:

>D

>B
smlj=0
=>sensor53 r
>R
smlj=0
>S
if upsecs>22
then
smlj|=1
endif
>M 2
+1,16,r,0,2400,Licht
1,=so3,512
1,=so4,<KeyIGot>
1,pm(r1.0.0)@1,Time,,Time,
1,pm(32.7.0)@1,V L1,V,V_L1,1
1,pm(52.7.0)@1,V L2,V,V_L2,1
1,pm(72.7.0)@1,V L3,V,V_L3,1
1,pm(31.7.0)@1,A L1,A,A_L1,1
1,pm(51.7.0)@1,A L2,A,A_L2,1
1,pm(71.7.0)@1,A L3,A,A_L3,1
+2,17,r,0,2400,Heizung
2,=so3,512
2,=so4,<KeyIGot>
2,pm(1.0.0)@1,Time,,Time
#

(I also tried it with the entries from the Tasmota docs, with the same behavior)

Using this with sensor53 d1 (also sensor53 d2) i get the following in the console:

10:36:57.531 SML: HDLC frame:
10:36:57.533 SML: LLC frame:
10:36:57.535 SML: GCM frame:
10:36:57.536 SML: Ended up in default case while unwrapping...(tag 48)
10:36:57.538 SML: Unknown data payload:

When I comment the line with "so4" I get data like this:

10:44:32.204 : 7e a0 76 ce ff 03 13 3c 02 e6 e7 00 db 08 4c 47 5a 67 72 97 30 17 5e 30 00 04 27 3c 0e ab 80 87 
10:44:32.363 : 3e 06 e8 87 87 f2 86 fe 53 24 76 65 e3 dd da 95 4d 61 00 88 71 c3 db e5 0f 21 50 71 4e 38 41 52 
10:44:32.523 : 20 75 b3 47 21 2d 87 63 d4 fc 9e b8 70 6f cc 1c e8 4a 62 d9 ac 71 95 7a 5d 80 4e f0 37 8d 8f 6d 
10:44:32.683 : 3c 9f ce 33 05 d8 1e cf c5 f8 cf 74 f2 65 31 97 b7 77 4f 11 9d 3a f1 7e 

So it looks like there is data coming, but it can't be decrypted. What am I missing? I have 2 Landis+Gyr E450 meters from Netz Burgenland and use the RJ12 connector to read data. They don't provide much information, just what you can find here https://www.netzburgenland.at/kundenservice/smart-metering/smart-metering/kundenschnittstelle.html.

gemu2015 commented 1 year ago

@dkneisz so the decrypting is not working as expected. (GCM frame) if you provide a raw dump with the according key i would debug the decoding in detail for you and check what is going wrong.

dkneisz commented 1 year ago

@gemu2015 if the raw dump is what I get with sensor53 d1, then It's the last output I mentioned before so:

7e a0 76 ce ff 03 13 3c 02 e6 e7 00 db 08 4c 47 5a 67 72 97 30 17 5e 30 00 04 27 3c 0e ab 80 87 3e 06 e8 87 87 f2 86 fe 53 24 76 65 e3 dd da 95 4d 61 00 88 71 c3 db e5 0f 21 50 71 4e 38 41 52 20 75 b3 47 21 2d 87 63 d4 fc 9e b8 70 6f cc 1c e8 4a 62 d9 ac 71 95 7a 5d 80 4e f0 37 8d 8f 6d 3c 9f ce 33 05 d8 1e cf c5 f8 cf 74 f2 65 31 97 b7 77 4f 11 9d 3a f1 7e 

The key is either 38782F413F4428472D4B615064536756 or 4D635166546A576E5A72347537782141. Since I got two meters I also got sent two keys (and yes, I tried both of them with both meters).

gemu2015 commented 1 year ago

ok will feed into my simulator and report later

gemu2015 commented 1 year ago

another unknown type of GCM header flags. is fixed now.

replace lib file with appended source.

GcmParser.cpp.zip

dkneisz commented 1 year ago

Decryption seems to be working now:

13:16:02.325 SML: decrypted block: 59 bytes
13:16:02.328 :>02 0e 12 00 eb 12 00 eb 12 00 ed 12 00 0a 12 02 
13:16:02.330 :>0e 12 02 14 06 00 00 09 cb 06 00 00 00 00 06 02 
13:16:02.332 :>dd 4f 05 06 00 00 00 00 12 00 46 12 00 00 12 00 
13:16:02.334 :>00 09 08 33 30 31 30 35 35 36 39 
13:16:02.364 :>00 09 08 33 30 31 30 35 35 36 39 

Now I still get "0.099" or "9.99" as a value for everything I tried so far.

gismo2004 commented 1 year ago

That's your data from above...

<Structure Qty="0E" >
  <UInt16 Value="00EB" />
  <UInt16 Value="00EB" />
  <UInt16 Value="00ED" />
  <UInt16 Value="000A" />
  <UInt16 Value="020E" />
  <UInt16 Value="0214" />
  <UInt32 Value="000009CB" />
  <UInt32 Value="00000000" />
  <UInt32 Value="02DD4F05" />
  <UInt32 Value="00000000" />
  <UInt16 Value="0046" />
  <UInt16 Value="0000" />
  <UInt16 Value="0000" />
  <!-- 30105569 -->
  <OctetString Value="3330313035353639" />
</Structure>
<!--
Extra data:
00 09 08 33 30 31 30 35 35 36 39
-->
dkneisz commented 1 year ago

@gismo2004 OK, I don't know what to do with that information. Can you provide an example that I can use in my script to get valid data out of this?

gismo2004 commented 1 year ago

@dkneisz you can use something like described here: https://github.com/arendst/Tasmota/issues/8790#issuecomment-1403207001 Your start pattern would be '020e' and then an offset of x for the values

dkneisz commented 1 year ago

@dkneisz you can use something like described here: #8790 (comment) Your start pattern would be '020e' and then an offset of x for the values

Thanks, I think I got it now. This is what I got so far:

>D

>B
smlj=0
=>sensor53 r
>R
smlj=0
>S
if upsecs>22
then
smlj|=1
endif
>M 2
+1,16,r,0,2400,Licht
1,=so3,512
1,=so4,<key>
1,020Ex1UUuu@1,Spannung L1,V,V_L1,0
1,020Ex4UUuu@1,Spannung L2,V,V_L3,0
1,020Ex7UUuu@1,Spannung L3,V,V_L3,0
1,020Ex10UUuu@100,Strom L1,A,A_L1,2
1,020Ex13UUuu@100,Strom L2,A,A_L2,2
1,020Ex16UUuu@100,Strom L3,A,A_L3,2
1,020Ex19UUuuUUuu@1,Leistung +P,W,W_IN,0
1,020Ex24UUuuUUuu@1,Leistung -P,W,W_OUT,0
1,020Ex29UUuuUUuu@1000,Zählerstand +P,kWh,kWh_total_IN,3
1,020Ex34UUuuUUuu@1000,Zählerstand -P,kWh,kWh_total_OUT,3

+2,17,r,0,2400,Heizung
2,=so3,512
2,=so4,<key>
2,020Ex1UUuu@1,Spannung L1,V,V_L1,0
2,020Ex4UUuu@1,Spannung L2,V,V_L3,0
2,020Ex7UUuu@1,Spannung L3,V,V_L3,0
2,020Ex10UUuu@100,Strom L1,A,A_L1,2
2,020Ex13UUuu@100,Strom L2,A,A_L2,2
2,020Ex16UUuu@100,Strom L3,A,A_L3,2
2,020Ex19UUuuUUuu@1,Leistung +P,W,W_IN,0
2,020Ex24UUuuUUuu@1,Leistung -P,W,W_OUT,0
2,020Ex29UUuuUUuu@1000,Zählerstand +P,kWh,kWh_total_IN,3
2,020Ex34UUuuUUuu@1000,Zählerstand -P,kWh,kWh_total_OUT,3
#

Edit: I updated the script, because it had some errors (wrong units).

Noschvie commented 1 year ago

@dkneisz you can use OBIS codes like 1.8.0 für better readability, examples in previous comments.

dkneisz commented 1 year ago

@dkneisz you can use OBIS codes like 1.8.0 für better readability, examples in previous comments.

I tried that at first, but it didn't work for me.

gismo2004 commented 1 year ago

@Noschvie I am not sure if this will work. If I check my messages, the obis codes are clearly visible in the decrypted data:

02 21 09 0c 07 e7 02 0b 06 10 11 33 ff 80 00 00 09 06 01 00 01 08 00 ff 06 00 37 b5 0f 09 06 01 00 01 08 01 ff 06 00 30 2d 82 09 06 01 00 01 08 02 ff 06 00 07 87 8d 09 06 01 00 01 07 00 ff 06 00 00 0a d2 09 06 01 00 02 08 00 ff 06 00 00 00 00 09 06 01 00 02 08 01 ff 06 00 00 00 00 09 06 01 00 02 08 02 ff 06 00 00 00 00 09 06 01 00 02 07 00 ff 06 00 00 00 00 09 06 01 00 03 08 00 ff 06 00 2a 95 0d 09 06 01 00 03 08 01 ff 06 00 24 f0 70 09 06 01 00 03 08 02 ff 06 00 05 a4 9d 09 06 01 00 03 07 00 ff 06 00 00 08 1b 09 06 01 00 04 08 00 ff 06 00 00 da 2a 09 06 01 00 04 08 01 ff 06 00 00 a2 75 09 06 01 00 04 08 02 ff 06 00 00 37 b5 09 06 01 00 04 07 00 ff 06 00 00 00 00 00 37 b5 09 06 01 00 04 07 00 ff 06 00 00 00 00 

1.0.1.8.0.255
01 00 01 08 00 ff 
DataType
06 
Data
0037b50f

So I would say, that @dkneisz can not use this as the data is missing the OBIS pattern.

Maybe this can be used differently, but at least a 1.8.0 will not work i think

Noschvie commented 1 year ago

@gismo2004 you are right, had a look to the docu, OBIS codes not part of the message. Austria Federal State specification...

dkneisz commented 1 year ago

It looks like I got it working with the above mentioned script. I still have the last 3 UInt16 values, that I don't know what they are (maybe the phase angle) and the OctetString.

The OctetString is the meter number, but I don't know how to decode this. When I use 1,020Ex50uuUUuuUUuuUUuuUU@1,ID,,ID,0 I get a wrong number, because it's interpreted as a number and not a string. The only thing I found in the docs is to use # for the scale parameter, but 1,020Ex50uuUUuuUUuuUUuuUU@#,ID,,ID,0 gives me an empty string. Is it possible to decode this as ASCII string, and if yes, how?

helter84 commented 1 year ago

Hi,

thank you for all your hard work so far. I am trying to read out a Landis+Gyr E450 from Wiener Netze.

My sensor53 d1 dump:

13:27:47.868 SML: decrypted block: 56 bytes 13:27:47.871 :>02 09 09 0c 07 e7 03 0b 06 0d 1b 2f ff 80 00 00 13:27:47.872 :>06 00 4d f0 c8 06 00 00 00 00 06 00 11 31 f7 06 13:27:47.874 :>00 08 a6 00 06 00 00 00 e6 06 00 00 00 00 06 00 13:27:47.876 :>00 00 58 06 00 00 00 15 13:27:47.916 :>00 00 58 06 00 00 00 15

@gismo2004 How do I find out what my start value (e.g. 0209) and my offset values (x...)would be?

I tried @dkneisz script and I am getting values in the Tasmota main menu, but they don't seem valid :(

D B smlj=0 =>sensor53 r R smlj=0 S if upsecs>22 then smlj|=1 endif M 1 +1,3,r,0,9600,Top38 1,=so3,512 1,=so4,KEY 1,020909x1UUuu@1,Spannung L1,V,V_L1,0 1,020909x4UUuu@1,Spannung L2,V,V_L3,0 1,020909x7UUuu@1,Spannung L3,V,V_L3,0 ,1,020909x10UUuu@100,Strom L1,A,A_L1,2 ,1,020909x13UUuu@100,Strom L2,A,A_L2,2 ,1,020909x16UUuu@100,Strom L3,A,A_L3,2 1,020909x19UUuuUUuu@1,Leistung +P,W,W_IN,0 ,1,020909x24UUuuUUuu@1,Leistung -P,W,W_OUT,0 1,020909x29UUuuUUuu@1000,Zählerstand +P,kWh,kWh_total_IN,3 ,1,020909x34UUuuUUuu@1000,Zählerstand -P,kWh,kWh_total_OUT,3 #

Thanks in advance for your help!

Edit: I am using the latest build from gemu2015/Sonoff/Tasmota Wemos D1 Mini (ESP8266) IR Reader

dkneisz commented 1 year ago

@helter84 Wiener Netze has a different data layout than Netz Burgenland, so you can't use my script. I'm not entirely sure, but I think Wiener Netze are using OBIS codes, so you might try using the script from Noschvie here https://github.com/arendst/Tasmota/issues/8790#issuecomment-1415828626

gismo2004 commented 1 year ago

@helter84 your data:

  <!-- 3/11/2023 1:27:47 PM -->
  <OctetString Value="07E7030B060D1B2FFF800000" />
  <UInt32 Value="004DF0C8" />
  <UInt32 Value="00000000" />
  <UInt32 Value="001131F7" />
  <UInt32 Value="0008A600" />
  <UInt32 Value="000000E6" />
  <UInt32 Value="00000000" />
  <UInt32 Value="00000058" />
  <UInt32 Value="00000015" />
</Structure>
<!--
Extra data:
00 00 58 06 00 00 00 15
-->

@dkneisz there is no OBIS in his data!

dkneisz commented 1 year ago

@gismo2004 OK, that's why I said I'm not sure. I would also be interested in how to get the XML you posted from the output.

helter84 commented 1 year ago

@dkneisz Thanks for your quick response!

ok, I am getting 0.099, 0.9 and 9.99 values, like you before.

Here is the dump:

13:55:46.768 SML: decrypted block: 56 bytes 13:55:46.770 :>02 09 09 0c 07 e7 03 0b 06 0d 37 2e ff 80 00 00 13:55:46.772 :>06 00 4d f1 38 06 00 00 00 00 06 00 11 32 1a 06 13:55:46.774 :>00 08 a6 00 06 00 00 00 e3 06 00 00 00 00 06 00 13:55:46.776 :>00 00 5b 06 00 00 00 15 13:55:46.816 :>00 00 5b 06 00 00 00 15

Any idea, anyone?

helter84 commented 1 year ago

@gismo2004 thank you! What would be my start value then? Also I am lokking for the offset. Sorry, I am very new to all of this - the description [above] (https://github.com/arendst/Tasmota/issues/8790#issuecomment-1403207001) does not help me.

dkneisz commented 1 year ago

@helter84 sorry, for the misdirection. Your start value could be 020909, like you already did in you script, and then count from there. So like this: 1,020909x14UUuuUUuu@1000,Zählerstand,kWh,kwH_out,0

I did a quick google search and the data should be something like this: +A Wh -A Wh +R varh -R varh +P W -P W +Q var -Q var

But don't take my word on it, I could (again) be wrong. Just compare the values you get to the values on your meter, that's what I did.

Edit: I'm still unsure how to get the string value for the OctetString, so If someone could help out with that I would appreciate it.

helter84 commented 1 year ago

@dkneisz no problem. It now works for Zählerstand like you described! Still not understanding though how much i have to offset the values - it is 3 in my case?

gismo2004 commented 1 year ago

@helter84 For all users without OBIS codes in the message, the offset method should be used. Check the screenshot on how the data is structured in your message message

This way you can at least find your offsets to your "start pattern" which can be 020909 in your case. Then count from there xx bytes to the next message you want to read (14 bytes means 28 letters) The 'UUuuUUuu' tells tasmota to read an unsigned long word (UInt32) --> check this: meter-metrics how to count another example: how to count2

I hope that helps...

@dkneisz as far as I know, tasmota can not convert it to a human-readable date/time stamp and I think it has no real benefit to do it. However, if you can read code check this GXDateTime.py and a very basic explanation here: click The tool I have used to create the xml is called "GXDLMSDirector/DLMS Translator"