KWH Counter
Moderators: grovkillen, Stuntteam, TD-er
KWH Counter
Hi All,
I have searched the whole internet, but i can not find a working solution to build a KWH meter with a D1 mini and a KWH meter.
What I have done:
I have a KWH meter. 1000imp per kwh and connected it to D5:
ESP Easy is configured as follow:
Result with a 500W balast:
W: is sometimes 1, and KWH is counting the pulses.
When I remove the calculation, the results are the same.
What am I doing wrong?
I have searched the whole internet, but i can not find a working solution to build a KWH meter with a D1 mini and a KWH meter.
What I have done:
I have a KWH meter. 1000imp per kwh and connected it to D5:
ESP Easy is configured as follow:
Result with a 500W balast:
W: is sometimes 1, and KWH is counting the pulses.
When I remove the calculation, the results are the same.
What am I doing wrong?
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: KWH Counter
Your time/interval is 10 seconds that mean that your momentary formula is correct. I have done the same on my energy meter here at home and it work just fine. The only thing I do different is that I have 2 decimals instead of zero... and D3 instead of D5.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
Re: KWH Counter
What do you mean by the "total count is not persistent" you wrote in the image?
Re: KWH Counter
If I use the normal version of ESP easy mega this text is automaticly added. "total count is not persistent"
In the dev version there is no such text.
I think it is strange that kwh is just counting the pulses. The formula does nothing.
I would like to see bij W the power usage at the moment and by KWH the power usage total.
I will add 2 decimals and try again.
In the dev version there is no such text.
I think it is strange that kwh is just counting the pulses. The formula does nothing.
I would like to see bij W the power usage at the moment and by KWH the power usage total.
I will add 2 decimals and try again.
Re: KWH Counter
Ah there has been a report about the formula not working for the pulse counter (and another plugin)
Re: KWH Counter
Aaah so it is a known bug / problem?
2 decimals are also not working and not showing.
Which version of ESP easy do I have to use for a working solution?
2 decimals are also not working and not showing.
Which version of ESP easy do I have to use for a working solution?
Re: KWH Counter
I think a future one, as it has not yet been fixed.
You can also do calculations in the rules.
Re: KWH Counter
I tried this solution again and it looks like the bug is still there.
I tried Release mega-20210223 (Normal) and ESP_Easy_mega_20210114_energy_ESP8266_4M1M.
What rules do I have to make to calculate the energy usage in watts?
Something like this?
on Airco#Count do
SendToHTTP Domoitczip,port,/json.htm?type=command¶m=udevice&idx=156&nvalue=0&svalue=[Airco#Count]*3600/10 //Sent to Domoticz
endon
I tried Release mega-20210223 (Normal) and ESP_Easy_mega_20210114_energy_ESP8266_4M1M.
What rules do I have to make to calculate the energy usage in watts?
Something like this?
on Airco#Count do
SendToHTTP Domoitczip,port,/json.htm?type=command¶m=udevice&idx=156&nvalue=0&svalue=[Airco#Count]*3600/10 //Sent to Domoticz
endon
Re: KWH Counter
That'll fire an update to Domoticz on every pulse of the counter, not sure if Domoticz likes that...
You'd better send that only once a minute or similar frequency:
And just for fun, I'd do the calculation before building the url for Domoticz
You'd better send that only once a minute or similar frequency:
And just for fun, I'd do the calculation before building the url for Domoticz
Code: Select all
on system#clock=All,**:** do
let,1,[Airco#Count]*360 // *3600/10 == *360, why do an unneeded division?
SendToHTTP Domoitczip,port,/json.htm?type=command¶m=udevice&idx=156&nvalue=0&svalue=[var#1] //Sent to Domoticz
endon
/Ton (PayPal.me)
Re: KWH Counter
Hi ATH,
Thanks a lot for the script!
Wil it run the script every 10 seconds If I change it to:
If I do it manually: http://domoticzip:port/json.htm?type=command¶m=udevice&idx=156&svalue=1000 it works.
ESP Easy log:
730433: EVENT: Airco#Count=6
730533: EVENT: Airco#Total=49
730633: EVENT: Airco#Time=31
Thanks a lot for the script!
Wil it run the script every 10 seconds If I change it to:
If I test it, domoticz does not get any updates.on system#clock=All,**:**:* do
If I do it manually: http://domoticzip:port/json.htm?type=command¶m=udevice&idx=156&svalue=1000 it works.
ESP Easy log:
730433: EVENT: Airco#Count=6
730533: EVENT: Airco#Total=49
730633: EVENT: Airco#Time=31
Re: KWH Counter
I found a working soliotion: Thanks to Ath!
Set the device at 10 seconds:
Hardware: D5 to S0+ and ground to S0-
1000 pulses/kwh
Domoticz: Create a virtual device Electric Instant + counter. Edit this device and set it to computed.
Code: Select all
on Airco#Count do
let,1,[Airco#Count]*360 // *3600/10 == *360, why do an unneeded division?
SendToHTTP ipdomoticz,port,/json.htm?type=command¶m=udevice&idx=156&nvalue=0&svalue=[var#1] //Sent to Domoticz
endon
Hardware: D5 to S0+ and ground to S0-
1000 pulses/kwh
Domoticz: Create a virtual device Electric Instant + counter. Edit this device and set it to computed.
Re: KWH Counter
Yes, the system#clock interval is max. 1 per minute, if you need a shorter interval you can set a loop-timer:
But your solution also works fine, so just keep that
An actual improvement would be to use the %eventvalue1% argument that is passed to the event:
The advantage is that %eventvalue1% holds the value of that variable at the moment the event was generated, and, as rules can be delayed during execution, the count value could have changed in the meantime.
Code: Select all
on system#boot do
loopTimerSet,1,10
endon
on rules#timer=1 do
let,1,[Airco#Count]*360 // *3600/10 == *360, why do an unneeded division?
SendToHTTP ipdomoticz,port,/json.htm?type=command¶m=udevice&idx=156&nvalue=0&svalue=[var#1] //Sent to Domoticz
endon
An actual improvement would be to use the %eventvalue1% argument that is passed to the event:
Code: Select all
on Airco#Count do
let,1,%eventvalue1%*360 // *3600/10 == *360, why do an unneeded division?
SendToHTTP ipdomoticz,port,/json.htm?type=command¶m=udevice&idx=156&nvalue=0&svalue=[var#1] //Sent to Domoticz
endon
/Ton (PayPal.me)
Re: KWH Counter
Thanks for the improvement!
I will at it to the script!
Thanks a lot!
I will at it to the script!
Thanks a lot!
Who is online
Users browsing this forum: No registered users and 0 guests