papperone, Yes. It happens to the Chinese mail.)))
There are no problems will wait.
By the way, in firmware WiFi-IoT (paid firmware builder) support this Power Monitor. ... but there is no support Domoticz (very bad and inconvenient support Domoticz).

Will start to test it to understand how it works then will translate it into a plugin, stay tuned

Hi ! Have any news ?

still testing it, the serial interface with PZEM 004T is a little weird and for sure non-standard; basic library sems to work but not stable, so I'm actually rewriting basic code in order to have a more reliable plugin
as soon as it's kind of "working state" I'll publish it in the Playground, dont' worry!

Plugin is in a kinda of working status, this sensor has some "features" which I try to adapt:

1) sensor library is quite messy and requests a manual update of the SoftwareSerial library for ESP8266 to v3.2.3
2) the module I do have fails all the readings if it's not connected to the main AC line
3) while it's ok to have V A and W to zero when no readings, the Energy reading (which is accumulated and saved on the flash memory of the module) shoudl be reported
4) to avoid point 3) issue I decided to check if the reading was OK and (only for the Energy) to retain old device value in order to always show the accumulated Wh
5) in case of no AC line to the module, the module reading are quite slower and thus serial-comm is used the ESP8266 become slugghish (so don't blame plugin but module!)
6) If you select wrong GPIOs you can experience an almost unusable ESP8266 (somehow SoftwareSerial setup to the wrong pins generate this unresponsivness)

below a current screenshot; I'm waiting the GitHub to be cleaned up after vacation (I see too many PU request pending) to avoid flooding with more requests.

please provide feedback/bugs in order to eventually fix them before to move to the main branch!

Hello and thank you for what you are doing!
I can try to test, but I do not understand where and how to download the firmware. And more, if it is possible, please give the scheme of connecting the ESP to PZEM004

please provide feedback/bugs in order to eventually fix them before to move to the main branch!

Hello and thank you for what you are doing!
I can try to test, but I do not understand where and how to download the firmware. And more, if it is possible, please give the scheme of connecting the ESP to PZEM004

You nee to download from GITHUB repository "playground" the pluing, as it's not part (yet) of the standard package.
Then you need to compile by yourself the firmware using Arduino IDE or Platformio (plenty of instruction on the Wiki).
Connection is pretty straightforward:
- VCC to 5V
- GND to GND
- TX to a free GPIO
- RX to a free GPIO
the last 2 GPIO then needs to be configured in the device page as SoftwareSerial is used.

Hey. I tried, but the result is zero. Maybe I did something wrong. I did this:
1. I took the file ESPEasy.ino from the package ESPEasy_v2.0.0-dev11 and opened it in Arduino IDE.
2. Created a new tab, named it _P171_PZEM-004T and inserted the contents into it by the link https://github.com/papperone/ESPEasyPlu ... M-004T.ino
3. Compiled the firmware file.
4. Filled the firmware in the ESP12-е.
5. In the settings of the web interface, configure the device, chose the GPIO for the SoftwareSerial.
However, all indications are zero ...

Hey. I tried, but the result is zero. Maybe I did something wrong. I did this:
1. I took the file ESPEasy.ino from the package ESPEasy_v2.0.0-dev11 and opened it in Arduino IDE.
2. Created a new tab, named it _P171_PZEM-004T and inserted the contents into it by the link https://github.com/papperone/ESPEasyPlu ... M-004T.ino
3. Compiled the firmware file.
4. Filled the firmware in the ESP12-е.
5. In the settings of the web interface, configure the device, chose the GPIO for the SoftwareSerial.
However, all indications are zero ...

Well, in general, the situation is as follows.
There is NodeMCU and PZEM-004T.
The system works, but only if you apply power to the PZEM after the NodeMCU boots up. Otherwise, NodeMCU simply does not load.
And further. Your code may have been created from an older version of the library. When using the new version of the library, an error occurs when compiling in Arduino IDE.

Well, in general, the situation is as follows.
There is NodeMCU and PZEM-004T.
The system works, but only if you apply power to the PZEM after the NodeMCU boots up. Otherwise, NodeMCU simply does not load.
And further. Your code may have been created from an older version of the library. When using the new version of the library, an error occurs when compiling in Arduino IDE.

I'm using latest version as I forket the GIT of the library...
which errors did you get so I can try to help you figure it out?
if it's related to SoftwareSerial, indeed the Arduino IDE push you to install a "newer" version which is buggy, so you need to downgrate this specific library to previous (which is again the officially GITHUB supported) in order to compile correctly...
(sorry I forgot to mention this!!)

PS; in my configuration the node boots up perfectly despite I applyed 230VAC or not to PZEM, just the sensor is unresponsive and sluggish as I already explained!

Plugin is in a kinda of working status, this sensor has some "features" which I try to adapt:

1) sensor library is quite messy and requests a manual update of the SoftwareSerial library for ESP8266 to v3.2.3
2) the module I do have fails all the readings if it's not connected to the main AC line
3) while it's ok to have V A and W to zero when no readings, the Energy reading (which is accumulated and saved on the flash memory of the module) shoudl be reported
4) to avoid point 3) issue I decided to check if the reading was OK and (only for the Energy) to retain old device value in order to always show the accumulated Wh
5) in case of no AC line to the module, the module reading are quite slower and thus serial-comm is used the ESP8266 become slugghish (so don't blame plugin but module!)
6) If you select wrong GPIOs you can experience an almost unusable ESP8266 (somehow SoftwareSerial setup to the wrong pins generate this unresponsivness)

below a current screenshot; I'm waiting the GitHub to be cleaned up after vacation (I see too many PU request pending) to avoid flooding with more requests.
Capture.JPG

Great job! Thanks.
but how to add those values to Domoticz?
if selected Dummy - Electric - only voltage

- RX and TX indications on the device page are somewhat confusing as there are referring to the pins on the esp side, so they have to be reversed compared to the pzem side. I changed the text in the version below to make it clearer
- I added some more debugging lines to make it easier to follow-up what's going on
- I noticed pzem answers in 2s when 220V is applied to the module and in 12s when no power is applied. So don't use polling time faster than 15s ; I dunno if there is a way to block that on the web page or at least to display it somewhere.

Now some problems I dunno how to fix by myself (yet ) as I'm a noob is espeasy programming !
- pzem initialisation is done at boot of the esp only, so any further changes in the GPIO pins are not taken in consideration. IMHO It should be done after any config change
- I made some experiments with two modules on the same esp, as I'm trying to build a 3 phase power analyser and the plugin does not handle this correctly : Only the first one is initialised correctly and both readings are made from the 1st one. Help would be very appreciated to remove this limitation

but how to add those values to Domoticz?
if selected Dummy - Electric - only voltage

I didn't find a clean way to get the values, but a workaroud : In domoticz I defined a dummy of type "3 phase Ampers" and I gave the idx of it to pzem plugin in espeasy. Then I used the following code in domoticz to read from the 3ph amp dummy and dispatch the infos in "real" devices :

thanks for your feedback...
at the moment the plugin is not build to allow multiple sensors connected to single ESP8266; no having more than one I can't test it

about PIN naming it's just a matter of convention, as for me I believe it's more relevant to map the pin function of ESP8266 (same when you connect an FTDI interface to program ESP8266 module, you need to link RX to TX and viceversa)...
I'm open to suggestion here, if the majority thinks it's better to reverse the naming so RX means on PZEM and not on ESP8266 we can submit such pull-request on github!

I have implement one PZEM connected to a ESP-12F and running a very simple custom sketch. It is installed at very beginning of the incoming electrical line so, it should measure the same as the meter of electrical provider. After 11 months comparing the two meters, I can say that it is very precise: around 0,45% difference!!!

So, in my opinion, it is a very good device in order to measure electrical consumption. I will be next two months on travel but I will try to migrate my sketch to ESP Easy + PZEM plugin. I will post any relevant information if it can help....

Also, let me thank all of you for your efforts in create this ESP Plugin. Great job !!!!

Well if you are not familiar with the structure of ESPEasy won't be that simple
I ned as well to make other pluging (for my personal needs) able to use multiple devices and still no time to devote to programming this...

Sorry, I don't know how to use git to make pull requests this will come also, please bear with my learning curve

I also found a workaround to have several modules using the "port" feature of espeasy but it's a bit ugly ; if anybody have urgent need of many module I can publish, if not I'll wait to find a better solution !

Great plugin!
All values show correctly in the web interface that runs on the esp.
At first, some values weren't Always displayed.
I solved that by using another power supply for the 5v supply for the pzem004t.
Maybe some other users can solve their problems reading the values knowing that.

Now, I can add the pzem to Domoticz without problems, only one value is displayed.. The voltage. Other then that, nothing shows.
I was wondering if it would be possible to choose an IDX for each value of the sensor?
I don't know if that is possible at all in esp-easy?

It would help me out a lot.
Since I'm not a die hard coder, I can't do it myself...

here is a fix for the problem of parameters being taken into account only at boot. Now things can be changed on the fly by re-doing initialisation at every "submit" of the form :

[ CODE ]

Sorry, I don't know how to use git to make pull requests this will come also, please bear with my learning curve

I also found a workaround to have several modules using the "port" feature of espeasy but it's a bit ugly ; if anybody have urgent need of many module I can publish, if not I'll wait to find a better solution !

Sorry for late reply but I missed your post; you are right about the bug on save changin parameter, it's enough to destroy the object so it will be recreated on the init (no need of the boolean flag), I will submit this bug-fix asap.
Can you please explain better what you mean with "port feature of espeasy" so I can implement the multiple sensor support? (you can share your code even via PM and I can incorporate with my plugin and publish it on GitHub to be tested)

Hello aleph0, could you put the compiled firmware with the plugin PZET-004?

Please find attached the version for 4Gb flash with all the "Testing" plugins enabled, including the PZEM-004T with my last modifications to handle two modules. Use "port" to select the module : port 0 for first module and port 1 for second module. Remember each module will take up to 12s to answer in case there is no voltage on the main terminal, so don't poll faster then 15s*the number of modules

Thank you very much, everything turned out, but as with many, only the voltage in domoticz is output, you gave an example above how to prescribe, so that this does not happen-I did not understand which folder I should throw it in?

I have put the code in the file device.Lua?
Don't know for sure if this is the correct file? Or how to do this correctly.
I do get four separate values now, as shown in the picture below.
But indeed the log stays empty.

Hope you can help me out here.
At least I want to log Voltage and Current.
So I hope this will be possible with my setup

Regarding domoticz code, you have two choices :
- either you copy it in the domoticz/script/lua folder with a name ending by _device.lua eg pzem_device.lua
- either you go to the tools menu->more-> events, create a new "lua" "device" script named as you want and replace the default content by the code I posted

You also need to edit the first lines of the script starting by local dev,_... to match the name of your own devices

Btw, it's normal for the dummy pzem log to be empty as we overload the object. You'll get the log from the devices managed by the script

I will look into that after work.
I have been looking for some setting regarding lua scripts as I thought I had to look in thst way. But didn't find any...
Now... I may have overlooked it, but can it be a specific version when it was introduced?
If i click update, It says it's the latest.

I can understand . This issue is now purely related to domoticz and not espeasy. So far, espeasy is doing the job correctly If it's ok for you all, I'll open a thread on the domoticz forum and upload a detailed tutorial over there. It'll be this week-end as I have no time for this during the week ; I'll post the link here when I'm done with it

Hi, I did everything as you do, but in the device tab, the values ​​are shown, and when you switch to auxiliary values ​​by zero, what else could it be? It is not entirely clear what values ​​to write when assigning a variable? Same as you on the screen or others?