Page 1 of 2

Pzem04t valueus splitting

Posted: Tuesday 16 February 2021 11:06
by spike318
Hi i've an Esp Easy conntected to Pzem04 module and works fine, but i only get te value's seperately when in make 4 devices in ESP EASY.
and for each i've created a seperate IDX,
2021-02-16 10_59_40-Window.png
2021-02-16 10_59_40-Window.png (18.36 KiB) Viewed 3668 times
and so i've each time selected a dummy for Current/Voltage/power. But is it possible to use one idx for example idx 107 en split te values into 4 seperate dummies ?
I hope you under stand what i mean.
2021-02-15 13_02_41-Window.png
2021-02-15 13_02_41-Window.png (81.26 KiB) Viewed 3668 times
2021-02-16 10_59_40-Window.png
2021-02-16 10_59_40-Window.png (18.36 KiB) Viewed 3668 times
this is what i mean when i created like this i've every index the first value on each idx.
hope someone can help me, it's working this way but i thing it's sendign to much data for i what i'll use

grtz Spike

Re: Pzem04t valueus splitting

Posted: Tuesday 16 February 2021 15:45
by xury
Almost cried trying using Espeasy with PZEMs. So I decided to use Tasmota and Nodered Getting data by MQTT splitting parsing and sending to Domoticz

Re: Pzem04t valueus splitting

Posted: Tuesday 16 February 2021 17:04
by waltervl
If I read the following topic they use ESPEASY Rules to send the data to domoticz viewtopic.php?p=198863#p198863
etrubin wrote: Tuesday 27 November 2018 17:14 Piacco!
1. In ESP EASY go to Tools-Advanced and enable Rules.
2. In ESP EASY go to your pzem device set name pzem1
3. In ESP EASY set Values as on pic:
ScreenClip.png

4. In ESP EASY go to Rules tab and place in text field:

Code: Select all

on pzem1#Current do

SendToHTTP 192.168.0.100,8080,/json.htm?type=command&param=udevice&idx=30&nvalue=0&svalue=[pzem1#Voltage] 
SendToHTTP 192.168.0.100,8080,/json.htm?type=command&param=udevice&idx=31&nvalue=0&svalue=[pzem1#Current] 
SendToHTTP 192.168.0.100,8080,/json.htm?type=command&param=udevice&idx=32&nvalue=0&svalue=[pzem1#Power] 

endon
do not forget to change IP, Port and IDX of each device.

Re: Pzem04t valueus splitting

Posted: Tuesday 27 April 2021 8:53
by spike318
i have a username and paswoord on my mqtt broker, where can i put these in this rule ?

Re: Pzem04t valueus splitting

Posted: Tuesday 27 April 2021 9:36
by spike318
i did this but no result

on pzem1#Current_A do

SendToHTTP spike:[email protected]:8080,/json.htm?type=command&param=udevice&idx=192&nvalue=0&svalue=[pzem1#Voltage_V]
SendToHTTP spike:[email protected]:8080,/json.htm?type=command&param=udevice&idx=191&nvalue=0&svalue=[pzem1#Current]
SendToHTTP spike:[email protected]:8080,/json.htm?type=command&param=udevice&idx=192&nvalue=0&svalue=[pzem1#Power]

endon

Re: Pzem04t valueus splitting

Posted: Tuesday 27 April 2021 11:42
by FireWizard
Hello @spike318,

Can you explain a little detailed, what type of devices you want to use in Domoticz.
What do they have to show.

You wrote:
i have a username and paswoord on my mqtt broker, where can i put these in this rule ?
Which rule? Normally the username/password for MQTT is set in the client request.

But:
SendToHTTP spike:[email protected]:8080,/json.htm?type=command&param=udevice&idx=192&nvalue=0&svalue=[pzem1#Voltage_V]
SendToHTTP spike:[email protected]:8080,/json.htm?type=command&param=udevice&idx=191&nvalue=0&svalue=[pzem1#Current]
SendToHTTP spike:[email protected]:8080,/json.htm?type=command&param=udevice&idx=192&nvalue=0&svalue=[pzem1#Power]
These are http JSON calls to Domoticz and has no relationship with MQTT.

Regards

Re: Pzem04t valueus splitting

Posted: Friday 30 April 2021 10:54
by spike318
i use esp easy energy , i want these values Image this is my config in esp easy
pzem.png
pzem.png (15.84 KiB) Viewed 3575 times
esp easy sent al the value to one idx, i want to seperate these.

and afther one is working i'll use 3 pzem modules on one wemos d1.

and i have set my mqqt broker

the value screen is an example of tasmota to domoticz but i want to use esp easy because i can use more pzem modules on one Wemos d1, or else i have to use for each pzem module one Wemos D1. Dus i gues there must be a simple solution to my problem i hope

Re: Pzem04t valueus splitting

Posted: Friday 30 April 2021 22:37
by FireWizard
Hello @spike318

Is it possible to show a screenshot of e.g. MQTT Explorer, so that we can see how it is published to your MQTT broker?

Would be helpfull.

Regards

Re: Pzem04t valueus splitting

Posted: Saturday 01 May 2021 10:48
by spike318
mqqt.png
mqqt.png (3.9 KiB) Viewed 3552 times
this is what the module sent to domoticz

Grtz Spike

Re: Pzem04t valueus splitting

Posted: Saturday 01 May 2021 11:48
by spike318
power, current, voltage, energy

Re: Pzem04t valueus splitting

Posted: Saturday 01 May 2021 15:26
by FireWizard
Hello @spike318

Sorry, that I keep asking questions, but for confirmation:

You receive from your device under the topic domoticz/in:
{"idx":190, "RSSI":8,"nvalue":0,"svalue":"21.80;0;236.10;0.28"}
This topic is configured in your esp easy software, I conclude.
But you do not have a suitable device who can handle these values.

I also understand that in the above message:

Power = 21.80 (in Watt or kilowatt?) I assume Watt.
Current = 0 A. This is not very accurate, as you obviously consumes power.
Voltage = 236.10 Volt
Energy =0.28 (Wh or kWh) I assume kWh

Power and Energy can be combined in one sensor Electric, but can also be separated
Current has its own sensor Ampere
Voltage has its own sensor Voltage

If I look to your picture, you want them separated.

As you are not able to use the received input directly in Domoticz, as there does not exist a widget that accept 4 values and can present the values,
you have to covert them to 3 or 4 idx in Domoticz. Node Red can do that for you.

In that case I suggest to modify your topic in the ESP Easy to something as pzem04t/device1
You can also omit the IDX, as this is specific Domoticz related.

If you can confirm, it is quite simple to create a Node Red flow.

Regards

Re: Pzem04t valueus splitting

Posted: Saturday 01 May 2021 18:11
by spike318
config.png
config.png (15.23 KiB) Viewed 3533 times
these are the value that i have in esp easy, on my Rasperry Pi i have node red running, but i'm a beginner in this so if you can help me please your welcome, and thans for all the efforts you do for me i appriciate this verry much

T

Posted: Sunday 02 May 2021 14:31
by FireWizard
Hello @spike318,

Sorry to say, but the more pictures you post, the more confused I get.

1. Domoticz has no sensor (widget) that can display power, current, voltage and energy in one and the same widget.
So you need separate sensors for power, current, voltage and energy, although you can combine power and energy in 1 widget.

2. It is a bad idea to publish a value to domoticz/in, which is not properly formatted for the sensor where the IDX is referring to.
Maybe and hopefully the message you send to domoticz/in is rejected by Domoticz as the part "command:udevice" is missing.
This commands contains for svalue 4 values separated by a semicolon (;). No sensor exists, that requires 4 values in the "svalue" field.
Probably you will find in the Domoticz log, a message indicating something as "MQTT bad command received".

In the last picture you send I see that you have the option (if you uncheck the box) an event for each individual value and if you check the box all values are combined in one message.

So there is no need for Node Red (or something else) to parse the message as it can be done by ESP-Easy.
But do not publish to domoticz/in!

I would suggest to create a topic for each pzem module and value, such as "pzem1/voltage, and publish that.
esp easy sent al the value to one idx, i want to separate these.
and after one is working i'll use 3 pzem modules on one wemos d1.
What is the purpose of the Wemos D1?

If the right values are published to the MQTT broker Node Red can send the right data, properly formatted, to the Domoticz sensor.
And that for each pzem module.

Can you show in MQTT Explorer, what you see if you change the topic to:
pzem1/power, pzem1/current, pzem1/voltage and pzem1/energy?
Make it simple so send just the value and their is no need for a Domoticz IDX, nvalue or svalue.
And uncheck the box.

Regards

Re: Pzem04t valueus splitting

Posted: Tuesday 04 May 2021 19:54
by spike318
2021-05-04 19_48_31-Window.png
2021-05-04 19_48_31-Window.png (8.2 KiB) Viewed 3504 times
2021-05-04 19_48_56-DIEPENBEEK.png
2021-05-04 19_48_56-DIEPENBEEK.png (8.99 KiB) Viewed 3504 times
Now i have this i've created an Dummy Electra+counter and i got hese value's , "Power:Current:Voltage:Energy" i just want these value's in a seperat dummy so i can log the power and energy ... (This is just the the latest version for Pzem and Esp Easy, no more testing) !

Grz Can't i do this by a DZevent or Lua Script ?

Re: Pzem04t valueus splitting

Posted: Tuesday 04 May 2021 22:37
by FireWizard
Hello @spike318

I said in my previous post:
2. It is a bad idea to publish a value to domoticz/in, which is not properly formatted for the sensor where the IDX is referring to.
Maybe and hopefully the message you send to domoticz/in is rejected by Domoticz as the part "command:udevice" is missing.
This commands contains for svalue 4 values separated by a semicolon (;). No sensor exists, that requires 4 values in the "svalue" field.
Probably you will find in the Domoticz log, a message indicating something as "MQTT bad command received".
You still send the data to Domoticz with the topic domoticz/in, which is not correctly formatted.

I also asked you:
If the right values are published to the MQTT broker Node Red can send the right data, properly formatted, to the Domoticz sensor.
And that for each pzem module.

Can you show in MQTT Explorer, what you see if you change the topic to:
pzem1/power, pzem1/current, pzem1/voltage and pzem1/energy?
Make it simple so send just the value and there is no need for a Domoticz IDX, nvalue or svalue.
And uncheck the box.
You ignored this request, so I'm sorry to say, that I'm not able to help you further, as I am not a specialist in dZVents or Lua.

Regards

Re: Pzem04t valueus splitting

Posted: Wednesday 05 May 2021 17:43
by spike318
Hi again i'll did the next thing and this is what is sent to domoticz by an esp easy rule
2021-05-05 17_37_04-Window.png
2021-05-05 17_37_04-Window.png (18.66 KiB) Viewed 3477 times
but i don't receive anyting
2021-05-05 17_37_04-Window.png
2021-05-05 17_37_04-Window.png (18.66 KiB) Viewed 3477 times
and in my mqtt explorer i can't fint these data, i'll miss something but i don't know it ?

Re: Pzem04t valueus splitting

Posted: Wednesday 05 May 2021 18:36
by waltervl
You are now NOT sending to MQTT but directly to the Domoticz API: https://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s

If you type the same command in a browser does it work? If yes, the rule in ESP Easy is wrong so the message becomes malformed.
The command below should set the voltage to 12V

Code: Select all

http://192.168.1.19:8080/json.htm?type=command&param=udevice&idx=200&nvalue=0&svalue=12

Re: Pzem04t valueus splitting

Posted: Wednesday 05 May 2021 19:16
by FireWizard
Hi again i'll did the next thing and this is what is sent to domoticz by an esp easy rule
You can go on with your "next thing", but I recommend to accept the support and give answers to the questions.

In this case, I see that you try to send:

Code: Select all

http://192.168.1.19,8080,/json.htm?type=command m=udevice&idx=198&nvalue=0&svalue=232
The comma (,) before 8080 should be a colon (:) and the comma after 8080 should be removed.
And what the character after command means? No clue.

And as said earlier and this is also clearly expressed by @waltervl, what you try to do has no relation with MQTT and you can watch for hours to your MQTT Explorer, but nothing will happen.

Regards

Re: Pzem04t valueus splitting

Posted: Thursday 06 May 2021 17:10
by spike318
Hi when i do the code i receive te value in domoticz, but when i put it in a rule, it doesn't work, but nevermind, i m gonna try again by mqtt and send more seperate values in Esp Easy ! I hope i ll get out of my problem.

Re: Pzem04t valueus splitting

Posted: Thursday 06 May 2021 18:13
by waltervl
Well, it is up to you but I think the http API/json way of working should be a lot easier. Just a matter of good ESP rule definition. There should be examples for that to find.