Rules for PZEM-004t energy meter (day/night consumption).

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
abcart
New user
Posts: 2
Joined: 18 Mar 2019, 10:57

Rules for PZEM-004t energy meter (day/night consumption).

#1 Post by abcart » 18 Mar 2019, 11:18

Hello, ESPEasy community!
Can somebody please help me with my scenario: I`m trying to make an energy meter for Domoticz using pzem-004t module, it is connected to WeMos D1 Mini, now it works and everything about it's data is correct.
The question is: the last value of this energy meter is total energy consumption (dynamically increasing value each 30 seconds, this value is also stored in pzem-004t flash), but since my energy operator has two tariffs (day (07AM:11PM)/night(11PM:07AM) - I need to divide this dynamically increasing value in two: one for day power consumption and another one for night power consumption.
I have tried to do that using ESPEasy rules, but looks like my syntax was wrong, so I can`t find out where the problem is.
The main idea in my algorithm: for each moment of 07AM and 11PM we need to fix our current energy consumption value using two variables (for example D for day and N for night).
Then we need to calculate energy consumption values for previous period and subtract it from our current value of energy consumption. After that we need to add an additional delta value for day and night to make these values equal to current parameters of my energy meter used in my home.
And then two values for day and for night will be translated to Domoticz using IDX`es of day/night counters.
Maybe somebody already has implemented such algorithm and can help me with Rules syntax?

abcart
New user
Posts: 2
Joined: 18 Mar 2019, 10:57

Re: Rules for PZEM-004t energy meter (day/night consumption).

#2 Post by abcart » 20 Mar 2019, 13:21

Here is a part of my Rules (trying to fix Energy value for 11PM in Dummy#2 Variable#1):

on EnergyMeter#Energy do //Each Energy value update do the following:
If %systime% = 23:00:00 //If current time is 11PM...
TaskValueSet 2,1,%eventvalue% //...set Dummy device#2 variable#1 value equal to current Energy metering value
endif
endon

And in this part of Rules I can`t get my Dummy#2 Var#1 equal to Energy value at 11PM, it remains "0".
I have also tried to use "On Clock#Time=All,23:00" instead of "If %systime% = 23:00:00", but with the same result.
So where is the problem in it?

And, BTW, what is the latest ESP Easy firmware release with PZEM-004t support?

Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 22 guests