-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PZEM Driver #11
Comments
multiple PZEM support could be easily added with a few minor modifications to my driver. according the complexity of coding the descriptors you are true, but once you have a descriptor it is simply a copy and paste operation. i will think of the 3 module expansion and once ready i will make a pr. Gerhard |
@meingraham greetings Gerhard >D >B >M 1 1,a0vvvvvvxx00xx@i0:1,Voltage P1,V,Voltage_P1,2 |
updated driver available better descriptor >D >M 1 1,a0vvvvvvxx00xx@1,Voltage P1,V,Voltage_P1,2 |
3 Phase PZEM driver >D >B >M 3 1,a0vvvvvvxx00xx@1,Voltage,V,Voltage,2 |
I have made several changes to the smart meter wiki article. Please review.
For any of these meters, how are the GPIO specified in the Template/Module? What are the component types to use? For example, typically one would specify the PZEM Tx/Rx in the Tasmota setup. You can only specify one PZEM in this manner and the specific components associates which driver to use. To use this driver (53), one cannot use the Tasmota component definitions; correct? Have you considered also the Modbus PZEM (v3) so you only need one pair of GPIO and allow all PZEM to be connected to the same GPIO and then specify each by "addressing" it via the serial protocol before requesting data from each PZEM? I'm referring to this post. Or can this already be done using the MODBUS part of your driver? For the PZEM descriptor, what is Mike |
i will check your changes tomorrow sensor53 r resets the driver with the new descriptor for debugging: the gpio pins may only be defined in the descriptor, in Tasmota GPIO selector they must be set to "none" otherwise a "double GPIO define error" is emitted in console and the descriptor is ignored the PZEM support is only for the PZEM-04 (not the MODBUS version) the PZEM MODBUS version however is NOT compatible to the standard MODBUS decoder which uses float numbers. the MODBUS PZEM uses half word registers. this device may be probably decoded in RAW mode. I personally would NEVER use PZEM for 3 phases. there are cheap complete 3 phase meters with MODBUS which provide a lot more functions, are much more precise and support reverse currents (for solar feeds) which is not possible with PZEM Gerhard |
I'll add the Vital information. I suspected as much. I wanted to confirm -
I'll incorporate this into the article after you've had a chance to review my other changes. I agree that using 3 PZEM-004T for 3-phase is a "kludgy"/"sketchy" solution. I would be interested in what 3-phase MODBUS devices you recommend. I rather steer users toward that and then use the MODBUS feature of your smart meter interface to integrate with Tasmota. Mike |
"c = set the driver to counter mode and preset counter (x = 1..5) to value" cmd sensor95 cx does not switch to counter mode but presets a counter of a meter when in counter mode => c = preset a counter in counter mode (x = 1..5) to value probably we should include the sensor53 cmds also in the sensor description file. according to PZEM i hesitate to put it into the documentation
according to the MODBUS driver my solution has the advantage of being adaptable to various meters and indeed addressing more then on device over a single MODBUS is possible. for 3 phase meters i would use the Eastron sdm530 or sdm630 (about 80-100 Euros) or at amazon or eBay there are a lot of 3 phase meters with MODBUS starting from about 50 Euros. or this very cheap china import (31 Dollars) |
Sensor95? I saw where you changed the descriptors a few days ago from 95 to 53. I have documented Sensor53 and included that in the meter documentation. What is Sensor95? I don't understand what you mean by this -
|
sorry sensor95 was the name for this driver i used for the last 2 years before merging to tasmota. you wrote in the wiki "c = set the driver to counter mode and preset counter (x = 1..5) to value" BUT sensor53 cx does NOT switch to counter mode but presets a counter of a meter WHEN in counter mode |
hi.. |
@rt400 you should see the default OBIS device in WEBUI and in configuration you should see the submenu "edit script" now copy the above single device descriptor in the edit script edit window, check enable script the descriptor assumes esp8266 RX and TX , so connect these to the PZEM. hopefully now you should see the PZEM values in the WEBUI if this works we may try the 3 phases solution thanks |
got a error :
i used with 2.5.2 core also downgrade to 2.3.0 and still got this error |
ok to check i downloaded my own repo and compiled with platformio. if you use Arduino IDE i have no advice whats wrong but you may use the official Tasmota DEV version and simply replace the sml53 file with the one from my fork. i meantime realized that you have the PZEM v3 with MODBUS telegram. i have to make a slight change for that and the above descriptors won't work. try to get scripting to work in the meantime. i will be back with a MODBUS descriptor later. |
here is a PZEM v3 descriptor
1,010404uuuuxxxxxxxx@i0:10,Voltage,V,voltage,2 |
Is „USE_SCRIPT“ already implemented for ESP32?
Same happening for „USE_LIGHT“ |
yes script works well on ESP32. this is due to a bug in scripter |
You sir saved my day. Thank you.
|
its not related to ESP32, it happens also with esp8266 strange however that the error is reported for light driver which has no reference to ScriptWebShow |
Hmm, okay that's weird. So the only way to handle this for me is:
Thank you my friend! Script working now btw ! :) |
#define USE_SCRIPT works for me at least with my latest version |
I have a question that is not specially for the PZEM driver but for scripts in general: I want to compute a load mean value from the measurements when they arrive and transmit this value with Any ideas? |
@herrfrei The >>T section. Sent with GitHawk |
Thanks for the hint. The |
you may access the >M registers directly with sml[x] |
you must compile with #define USE_SML_SCRIPT_CMD |
Many thanks for the hint! |
Is this discussion what led to the ModuleAddress command and if so would it be possible to expand this from 3 addresses? I am considering using these PZEM modules to monitor multiple circuits at the service panel and would like to be able to connect multiple modules to a single wemo D1 but the current ModuleAddress command only allows for 3 unique addresses and they seem to be related in a 3 phase arrangement where as I would like the different modules to be completely separate topics. |
PZEM is no longer officially supported by this driver because the Tasmota standard PZEM driver works for most users. |
Thank you, I will pursue the Tasmota PZEM driver, I thought that's what this was. Sorry. |
yes i know, but this shows that the cmd is correct. then sml(1 3 "r1542") should also work |
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
->sensor53 r 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.
|
still no reset
->sensor53 r |
ok, will check tomorrow what is wrong |
Thank you for your help |
try one thing, btw this mode only works with a descriptor that has values to send, so use your normal settings, |
->sensor53 d1
1,150404UUuuxxxxxxxx@i0:10,Voltage,V,Boiler-V,2 after restart 00:00:00.001 HDW: ESP8266EX 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.
->sensor53 d1
print sending sml(1 3 meterreset)
+1,3,m,0,9600,ENERGY,1,1,15040000,15040007,15040003,15040005 1,150404UUuuxxxxxxxx@i0:10,Voltage,V,Boiler-V,2 14:21:47.403 > 15 04 00 00 00 02 72 df |
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 |
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?
+1,3,m,0,9600,ENERGY,1,1,15040000,15040007,15040003,15040005 1,150404UUuuxxxxxxxx@i0:10,Voltage,V,Boiler-V,2
Output: 04:18:04.229 : 15 04 04 2d 2a 00 00 87 21 |
i used your script slightly modified 11:31:06.918 > 15 04 00 07 00 02 c3 1e |
I loaded your script and this is what I get. This is compiled against the sonfftasmota source. 04:42:57.884 > 15 04 00 07 00 02 c3 1e |
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. |
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. 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 😉 But there have been several threads with this topic so I think it is relevant.
The text was updated successfully, but these errors were encountered: