Open meingraham opened 5 years ago
Try with the meter dev also with r
I only coded the dev above to test the reset my running dev is
+1,3,m,0,9600,ENERGY,1,1,15040000,15040008,15040003,15040005,01040003,01040005,02040003,02040005,03040003,03040005,04040003,04040005,05040003,05040005,06040003,06040005,07040003,07040005,08040003,08040005,09040003,09040005,0a040003,0a040005,0b040003,0b040005,15040003,15040005,15040003,15040005,15040003,15040005,15040003,15040005,15040003,15040005,15040003,15040005,15040003,15040005,15040003,15040005
Which are all slave address+6 byte strings
just for test try this
+1,3,m,0,9600,ENERGY,1,1,r1542
if this fails sml(...) will also fail
That reset the meter but I cannot run with that or the meter will be reset every time the script starts
yes i know, but this shows that the cmd is correct.
then sml(1 3 "r1542") should also work you must issue this cmd e.g. in section >B
Wouldn't that only execute on boot? I am trying to run it from a sub routine called by mqtt.
of course later you can use it anywhere. We just want to prove it works like expected
My boot section is
B
->sensor53 r sml(1 3 "r1542")
and I do not get a reset. Should this work in >B before the meter is defined?
the meter is defined by ->sensor53 r
probably try this in >S every second, just to see what happens
oh, sorry i forgot that this command only works with stored strings.
D str="r1542"
B ->sensor53 r sml(1 3 str)
still no reset
D meterreset="r1542" B
->sensor53 r sml(1 3 meterreset)
ok, will check tomorrow what is wrong
Thank you for your help
try one thing, send the string every second, and then go to dump mode. you should then see the string dumped between your normal values
btw this mode only works with a descriptor that has values to send, so use your normal settings,
D P="0404UUuuUUuusxxxx@i" h="1,=h
" c="" E=":1000,Energy,kWh," W=":2.5,Power,W," H="HotTub" B="Boiler" D="Dryer" C="Compressor" S="Stove" WH="Waterheater" num="1" meterreset="r1542" B
->sensor53 d1 sml(1 3 meterreset)
M 1 +1,3,m,0,9600,ENERGY,1,1,15040000,15040008,15040003,15040005,01040003,01040005,02040003,02040005,03040003,03040005,04040003,04040005,05040003,05040005,06040003,06040005,07040003,07040005,08040003,08040005,09040003,09040005,0a040003,0a040005,0b040003,0b040005,15040003,15040005,15040003,15040005,15040003,15040005,15040003,15040005,15040003,15040005,15040003,15040005,15040003,15040005,15040003,15040005
1,150404UUuuxxxxxxxx@i0:10,Voltage,V,Boiler-V,2 1,150404UUuuxxxxxxxx@i1:10,Frequency,Hz,Boiler-PF,2
after restart
00:00:00.001 HDW: ESP8266EX 00:00:00.050 CFG: Loaded from flash at F5, Count 84 00:00:00.054 SER: Set to 8N1 9600 bit/s 00:00:00.056 QPC: Count 1 00:00:00.064 Project tasmota - Power Version 10.1.0(tasmota)-2_7_4_9(2022-02-11T14:37:53) 00:00:00.560 WIF: Connecting to AP1 OpenWrt Channel 11 BSSId 94:10:3E:07:63:09 in mode 11n as Wemo-3777... 00:00:03.756 WIF: Connected 00:00:04.009 HTP: Web server active on Wemo-3777 with IP address 192.168.2.107 00:00:04.011 UPP: Multicast (re)joined 12:44:15.034 MQT: Attempting connection... 12:44:15.046 MQT: Connected 12:44:15.048 MQT: tele/Wemo/LWT = Online (retained) 12:44:15.050 MQT: cmnd/Wemo/POWER = 12:44:15.056 MQT: tele/Wemo/INFO1 = {"Info1":{"Module":"Generic","Version":"10.1.0(tasmota)","FallbackTopic":"cmnd/DVES_29EEC1_fb/","GroupTopic":"cmnd/tasmotas/"}} 12:44:15.059 MQT: tele/Wemo/INFO2 = {"Info2":{"WebServerMode":"Admin","Hostname":"Wemo-3777","IPAddress":"192.168.2.107"}} 12:44:15.061 MQT: tele/Wemo/INFO3 = {"Info3":{"RestartReason":"Power On"}} 12:44:16.036 UPP: Multicast (re)joined 12:44:16.434 QPC: Reset 12:44:19.386 MQT: tele/Wemo/STATE = {"Time":"2022-02-11T12:44:19","Uptime":"0T00:00:11","UptimeSec":11,"Heap":21,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"Wifi":{"AP":1,"SSId":"OpenWrt","BSSId":"94:10:3E:07:63:09","Channel":11,"Mode":"11n","RSSI":64,"Signal":-68,"LinkCount":1,"Downtime":"0T00:00:05"}} 12:44:29.406 MQT: tele/Wemo/STATE = {"Time":"2022-02-11T12:44:29","Uptime":"0T00:00:21","UptimeSec":21,"Heap":20,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"Wifi":{"AP":1,"SSId":"OpenWrt","BSSId":"94:10:3E:07:63:09","Channel":11,"Mode":"11n","RSSI":70,"Signal":-65,"LinkCount":1,"Downtime":"0T00:00:05"}} 12:44:39.430 MQT: tele/Wemo/STATE = {"Time":"2022-02-11T12:44:39","Uptime":"0T00:00:31","UptimeSec":31,"Heap":20,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"Wifi":{"AP":1,"SSId":"OpenWrt","BSSId":"94:10:3E:07:63:09","Channel":11,"Mode":"11n","RSSI":70,"Signal":-65,"LinkCount":1,"Downtime":"0T00:00:05"}} 12:44:49.389 MQT: tele/Wemo/STATE = {"Time":"2022-02-11T12:44:49","Uptime":"0T00:00:41","UptimeSec":41,"Heap":20,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"Wifi":{"AP":1,"SSId":"OpenWrt","BSSId":"94:10:3E:07:63:09","Channel":11,"Mode":"11n","RSSI":70,"Signal":-65,"LinkCount":1,"Downtime":"0T00:00:05"}} 12:44:59.412 MQT: tele/Wemo/STATE = {"Time":"2022-02-11T12:44:59","Uptime":"0T00:00:51","UptimeSec":51,"Heap":19,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"Wifi":{"AP":1,"SSId":"OpenWrt","BSSId":"94:10:3E:07:63:09","Channel":11,"Mode":"11n","RSSI":60,"Signal":-70,"LinkCount":1,"Downtime":"0T00:00:05"}} 12:45:09.412 MQT: tele/Wemo/STATE = {"Time":"2022-02-11T12:45:09","Uptime":"0T00:01:01","UptimeSec":61,"Heap":20,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"Wifi":{"AP":1,"SSId":"OpenWrt","BSSId":"94:10:3E:07:63:09","Channel":11,"Mode":"11n","RSSI":68,"Signal":-66,"LinkCount":1,"Downtime":"0T00:00:05"}}
Meter script is not working and no sensor display on webui
apparently the script has to be ->sensor53 d1 when booted then switched to dump mode. If I switch to dump mode while it is running I get the following which shows that the sml command is not being sent.
D P="0404UUuuUUuusxxxx@i" h="1,=h
" c="" E=":1000,Energy,kWh," W=":2.5,Power,W," H="HotTub" B="Boiler" D="Dryer" C="Compressor" S="Stove" WH="Waterheater" num="1" meterreset="r1542" B
->sensor53 d1
S
print sending sml(1 3 meterreset) sml(1 3 meterreset)
M 1
+1,3,m,0,9600,ENERGY,1,1,15040000,15040007,15040003,15040005
1,150404UUuuxxxxxxxx@i0:10,Voltage,V,Boiler-V,2 1,150404UUuuxxxxxxxx@i1:10,Frequency,Hz,Boiler-PF,2 %h%%c%%B% 1,15%P%2%W%%B%-W,2 1,15%P%3%E%%B%-kWh,4
#
14:21:47.403 > 15 04 00 00 00 02 72 df 14:21:47.406 sending sml(1 3 meterreset) 14:21:47.451 : 15 04 04 04 ca 00 3c 8e 9a 14:21:47.506 > 15 04 00 07 00 02 c3 1e 14:21:47.553 : 15 04 04 02 58 00 05 ef ed 14:21:47.604 > 15 04 00 03 00 02 82 df 14:21:47.653 : 15 04 04 00 04 00 00 ee 44 14:21:47.707 > 15 04 00 05 00 02 62 de 14:21:47.754 : 15 04 04 00 47 00 00 1f 90 14:21:47.804 > 15 04 00 00 00 02 72 df 14:21:47.854 : 15 04 04 04 ca 00 3c 8e 9a 14:21:47.910 > 15 04 00 07 00 02 c3 1e 14:21:47.955 : 15 04 04 02 58 00 05 ef ed 14:21:48.012 > 15 04 00 03 00 02 82 df 14:21:48.060 : 15 04 04 00 04 00 00 ee 44 14:21:48.113 > 15 04 00 05 00 02 62 de 14:21:48.165 : 15 04 04 00 47 00 00 1f 90 14:21:48.254 > 15 04 00 00 00 02 72 df 14:21:48.297 : 15 04 04 04 ca 00 3c 8e 9a 14:21:48.349 > 15 04 00 07 00 02 c3 1e 14:21:48.398 : 15 04 04 02 58 00 05 ef ed 14:21:48.401 > 15 04 00 03 00 02 82 df 14:21:48.403 sending sml(1 3 meterreset) 14:21:48.448 : 15 04 04 00 04 00 00 ee 44 14:21:48.551 > 15 04 00 05 00 02 62 de 14:21:48.599 : 15 04 04 00 47 00 00 1f 90 14:21:48.602 > 15 04 00 00 00 02 72 df 14:21:48.649 : 15 04 04 04 ca 00 3c 8e 9a 14:21:48.751 > 15 04 00 07 00 02 c3 1e 14:21:48.800 : 15 04 04 02 58 00 05 ef ed 14:21:48.805 > 15 04 00 03 00 02 82 df 14:21:48.849 : 15 04 04 00 04 14:21:48.891 : 00 00 ee 44 14:21:48.945 > 15 04 00 05 00 02 62 de 14:21:48.991 : 15 04 04 00 47 00 00 1f 90 14:21:49.044 > 15 04 00 00 00 02 72 df 14:21:49.094 : 15 04 04 04 ca 00 3c 8e 9a 14:21:49.149 > 15 04 00 07 00 02 c3 1e 14:21:49.193 : 15 04 04 02 58 00 05 ef ed 14:21:49.245 > 15 04 00 03 00 02 82 df 14:21:49.295 : 15 04 04 00 04 00 00 ee 44 14:21:49.345 > 15 04 00 05 00 02 62 de 14:21:49.396 : 15 04 04 00 47 00 00 1f 90 14:21:49.399 sending sml(1 3 meterreset) 14:21:49.447 > 15 04 00 00 00 02 72 df 14:21:49.497 : 15 04 04 04 ca 00 3c 8e 9a 14:21:49.549 > 15 04 00 07 00 02 c3 1e 14:21:49.599 : 15 04 04 02 58 00 00 2f ee 14:21:49.650 > 15 04 00 03 00 02 82 df 14:21:49.700 : 15 04 04 00 00 00 00 af 85 14:21:49.702 > 15 04 00 05 00 02 62 de 14:21:49.750 : 15 04 04 00 47 00 00 1f 90 14:21:49.851 > 15 04 00 00 00 02 72 df 14:21:49.900 : 15 04 04 04 ca 00 3c 8e 9a 14:21:49.952 > 15 04 00 07 00 02 c3 1e 14:21:49.003 : 15 04 04 02 57 00 00 1f ed 14:21:50.002 > 15 04 00 03 00 02 82 df 14:21:50.047 : 15 04 04 00 00 00 00 af 85 14:21:50.098 > 15 04 00 05 00 02 62 de 14:21:50.148 : 15 04 04 00 47 00 00 1f 90 14:21:50.201 > 15 04 00 00 00 02 72 df 14:21:50.248 : 15 04 04 04 ca 00 3c 8e 9a 14:21:50.299 > 15 04 00 07 00 02 c3 1e 14:21:50.349 : 15 04 04 02 58 00 00 2f ee 14:21:50.400 > 15 04 00 03 00 02 82 df 14:21:50.403 sending sml(1 3 meterreset) 14:21:50.449 : 15 04 04 00 00 00 00 af 85 14:21:50.501 > 15 04 00 05 00 02 62 de 14:21:50.550 : 15 04 04 00 47 00 00 1f 90 14:21:50.602 > 15 04 00 00 00 02 72 df 14:21:50.690 : 15 04 04 04 ca 00 3c 8e 9a 14:21:50.734 > 15 04 00 07 00 02 c3 1e
I compiled with the 2 files you sent me but do I need any #defines?
I'm using Arends Tasmota source, is that going to cause a problem with these changes?
your initialization is wrong you omitted sensor53 r this cmd is essential it loads the descriptor i checked on a test system an all goes well.
Sorry, I misunderstood the docs to mean that you use either sensor53 r OR sensor53 dN. Running the script below I do not see the 1542 sequence going out. The print is included so I know when the sml command went out. Could you send a copy of the script you used so I can compare to mine and see what I am doing wrong? Also was I supposed to do anything other than replace the 2 files you sent before compiling?
D P="0404UUuuUUuusxxxx@i" h="1,=h
" c="" E=":1000,Energy,kWh," W=":2.5,Power,W," H="HotTub" B="Boiler" D="Dryer" C="Compressor" S="Stove" WH="Waterheater" meterreset="r1542" B ->sensor53 r ->sensor53 d1M 1
+1,3,m,0,9600,ENERGY,1,1,15040000,15040007,15040003,15040005
1,150404UUuuxxxxxxxx@i0:10,Voltage,V,Boiler-V,2 1,150404UUuuxxxxxxxx@i1:10,Frequency,Hz,Boiler-hz,2 %h%%c%%B% 1,15%P%2%W%%B%-W,2 1,15%P%3%E%%B%-kWh,4
#
S sml(1 3 meterreset) print sml(1 3 %meterreset%)
Output:
04:18:04.229 : 15 04 04 2d 2a 00 00 87 21 04:18:04.281 > 15 04 00 00 00 02 72 df 04:18:04.330 : 15 04 04 04 c1 50 f1 02 cd 04:18:04.381 > 15 04 00 07 00 02 c3 1e 04:18:04.384 sml(1 3 r1542) 04:18:04.430 : 15 04 04 02 58 00 4f 6e 1a 04:18:04.484 > 15 04 00 03 00 02 82 df 04:18:04.573 : 15 04 04 4d 96 00 00 58 c5 04:18:04.617 > 15 04 00 05 00 02 62 de 04:18:04.666 : 15 04 04 2d 2b 00 00 d6 e1 04:18:04.717 > 15 04 00 00 00 02 72 df 04:18:04.766 : 15 04 04 04 c0 50 ad 53 34 04:18:04.816 > 15 04 00 07 00 02 c3 1e 04:18:04.865 : 15 04 04 02 58 00 50 2f d2 04:18:04.917 > 15 04 00 03 00 02 82 df 04:18:04.965 : 15 04 04 4e 63 00 00 48 b3 04:18:05.012 > 15 04 00 05 00 02 62 de 04:18:05.060 : 15 04 04 2d 2b 00 00 d6 e1 04:18:05.113 > 15 04 00 00 00 02 72 df 04:18:05.161 : 15 04 04 04 c0 50 ad 53 34 04:18:05.213 > 15 04 00 07 00 02 c3 1e 04:18:05.261 : 15 04 04 02 57 00 50 1f d1 04:18:05.312 > 15 04 00 03 00 02 82 df 04:18:05.362 : 15 04 04 4e 63 00 00 48 b3 04:18:05.412 > 15 04 00 05 00 02 62 de 04:18:05.415 sml(1 3 r1542) 04:18:05.462 : 15 04 04 2d 2b 00 00 d6 e1 04:18:05.514 > 15 04 00 00 00 02 72 df 04:18:05.563 : 15 04 04 04 c0 50 ad 53 34 04:18:05.614 > 15 04 00 07 00 02 c3 1e
i used your script slightly modified and i get this
11:31:06.918 > 15 04 00 07 00 02 c3 1e 11:31:06.968 sending sml(1 3 meterreset) 11:31:07.020 > 15 42 8f 11 11:31:07.118 > 15 04 00 03 00 02 82 df 11:31:07.287 > 15 04 00 05 00 02 62 de 11:31:07.380 > 15 04 00 00 00 02 72 df 11:31:07.482 > 15 04 00 07 00 02 c3 1e 11:31:07.580 > 15 04 00 03 00 02 82 df 11:31:07.682 > 15 04 00 05 00 02 62 de 11:31:07.780 > 15 04 00 00 00 02 72 df 11:31:07.882 > 15 04 00 07 00 02 c3 1e 11:31:07.980 > 15 04 00 03 00 02 82 df 11:31:07.982 sending sml(1 3 meterreset) 11:31:08.083 > 15 42 8f 11 11:31:08.181 > 15 04 00 05 00 02 62 de 11:31:08.283 > 15 04 00 00 00 02 72 df 11:31:08.381 > 15 04 00 07 00 02 c3 1e 11:31:08.483 > 15 04 00 03 00 02 82 df 11:31:08.581 > 15 04 00 05 00 02 62 de 11:31:08.683 > 15 04 00 00 00 02 72 df 11:31:08.781 > 15 04 00 07 00 02 c3 1e 11:31:08.883 > 15 04 00 03 00 02 82 df 11:31:08.981 > 15 04 00 05 00 02 62 de 11:31:08.983 sending sml(1 3 meterreset) 11:31:09.083 > 15 42 8f 11 11:31:09.181 > 15 04 00 00 00 02 72 df 11:31:09.283 > 15 04 00 07 00 02 c3 1e 11:31:09.381 > 15 04 00 03 00 02 82 df 11:31:09.483 > 15 04 00 05 00 02 62 de 11:31:09.581 > 15 04 00 00 00 02 72 df 11:31:09.683 > 15 04 00 07 00 02 c3 1e 11:31:09.838 > 15 04 00 03 00 02 82 df 11:31:09.885 > 15 04 00 05 00 02 62 de 11:31:09.983 > 15 04 00 00 00 02 72 df 11:31:09.985 sending sml(1 3 meterreset)
I loaded your script and this is what I get. This is compiled against the sonfftasmota source. There is something different about out binaries
04:42:57.884 > 15 04 00 07 00 02 c3 1e 04:42:57.931 : 15 04 04 02 58 00 4e af da 04:42:57.981 > 15 04 00 03 00 02 82 df 04:42:58.030 : 15 04 04 4a b2 00 00 19 ba 04:42:58.081 > 15 04 00 05 00 02 62 de 04:42:58.130 : 15 04 04 30 04:42:58.173 : 4f 00 00 91 52 04:42:58.176 > 15 04 00 00 00 02 72 df 04:42:58.223 : 15 04 04 04 bc 4f 6d 9a 8c 04:42:58.274 > 15 04 00 07 00 02 c3 1e 04:42:58.324 : 15 04 04 02 58 00 4e af da 04:42:58.375 > 15 04 00 03 00 02 82 df 04:42:58.425 : 15 04 04 4a b2 00 00 19 ba 04:42:58.428 sending sml(1 3 meterreset) 04:42:58.476 > 15 04 00 05 00 02 62 de 04:42:58.525 : 15 04 04 30 4f 00 00 91 52 04:42:58.579 > 15 04 00 00 00 02 72 df 04:42:58.627 : 15 04 04 04 bc 4f 09 9b 67 04:42:58.679 > 15 04 00 07 00 02 c3 1e 04:42:58.728 : 15 04 04 02 58 00 4e af da 04:42:58.778 > 15 04 00 03 00 02 82 df 04:42:58.829 : 15 04 04 4b 09 00 00 68 63 04:42:58.879 > 15 04 00 05 00 02 62 de 04:42:58.928 : 15 04 04 30 50 00 00 a0 94 04:42:58.980 > 15 04 00 00 00 02 72 df 04:42:59.029 : 15 04 04 04 bc 4f 09 9b 67 04:42:59.081 > 15 04 00 07 00 02 c3 1e 04:42:59.129 : 15 04 04 02 58 00 4e af da 04:42:59.181 > 15 04 00 03 00 02 82 df 04:42:59.229 : 15 04 04 4b 09 00 00 68 63 04:42:59.283 > 15 04 00 05 00 02 62
this morning it was also integrated into latest Tasmota dev
in doubt use my last dev version to verify
did you forget to define USE_SML_SCRIPT_CMD ?
USE_SML_SCRIPT_CMD was it. I did not have it defined, works like a champ now. Thank you very much for all your help.
it would be great if would put your working script into tasmota sml doc examples for others to use
I will do that, I will remove all the var substitutions first so it is more readable. to be clear you mean in https://tasmota.github.io/docs/Smart-Meter-Interface/
I'm trying to get the last piece of the puzzle together so I can post a script but I can't seem to get the string into the script from mqtt.
I created a sub, RST, and I can sent cmnd/Wemo/RST 1542 and it will reset the counter. However you stated that I should raw so I tried to send cmnd/Wemo/RST r1542 and the script gets garbage characters. I also tried the cmnd/Wemo/Script >num=r1542 but cannot change the variable value. As I stated I can get it to work if I just send the 1542 but this is not technically correct and I don't want to post something that will only sort of work. What am I missing?
All of the above works but I needed to quote the quotes '"r1542"' so that my mqtt client didn't strip them and send numeric data to a string var.
alas it appears to been in vain. The PZEM004T V3 cannot apparently be connected in parallel with another PZEM004T. The first one that sees the ESP8266 blocks the others. While the device is modbus it has it's own ttl converter and unless I am missing somet hing they do not play nice together.
this would be a serve design failure and not a MODBUS device. may be you can decouple devices by diodes like you had to do with the older PZEM devices
One of the devices has a power supply problem, possible short. the 3.3 supply is only 2.8 and it is spewing random data, sometimes part of a response that is correct sometime just garbage. In view of this I do not even know if it took the address change as I cannot successfully read the register. With that device out the other two I have seem to play nice. I need to get 10 more, I just hope I have a better failure rate.
I can't seem to figure out how to use =m with my decode lines. I would like to subtract 65W from the value returned in this decode line.
1,020404UUuuUUuusxxxx@i4:10,Power,W,HotTub-W,2
since almost all meters are calibrated we did not need an offset up to now. PZEM devices are not calibrated so i introduced an optional offset now. add or subtract your offset after the scaling factor.
1,020404UUuuUUuusxxxx@i4:10+65,Power,W,HotTub-W,2
Fantastic! Thank you so much for all your help.
@gemu2015
Some discussion on Discord re: 3-phase power monitoring with Tasmota. In particular, using multiple inexpensive PZEM-004T modules. I suggested that perhaps the smart meter interface you added recently might be a means to achieve that. The main issue that most mentioned is the advanced skill level required. Understanding how to compile all the appropriate features, understanding the meter protocol, coding the appropriate descriptor, etc. Although the smart meter interface provide a great deal of flexibility and expandability, it may be too much for "average" users.
For users who just want a black box solution, the thought of enhancing the current PZEM driver to add addressability of multiple modules was considered. Do you think this is feasible?
ESPHome seems to be supporting more of this type of capability, I don't care for ESPHome, but many high profile users seems to be considering it over Tasmota, especially if they are Home Assistant users. With the advent of more ESP32 based devices (e.g., https://circuitsetup.us/index.php/product/expandable-6-channel-esp32-energy-meter/), ESPHome is making an inroads since they support the ESP32.
Anyway, I thought I'd reach out to get your thoughts about enhancing the PZEM driver for "simple" 3-phase monitors.
Regards.
Mike
P.S. I don't even have a need for a 3-phase monitor :wink: But there have been several threads with this topic so I think it is relevant.