DrXtreme
(Sofian Benissa)
April 14, 2023, 6:05pm
1
Hello All,
I finally set up my current meter readings and I can see a graph of historic data with max,min, and mean values…
I would like to convert this to watts by multiplying it to 220v (later I’d put in actual voltage from a sensor) and then sum the hours to get KWH per day…
Is it possible? How can I get this done? Markup card maybe?
Markdown code:
{{ (states('sensor.watermotor_gridcurrent')| float * 220)}} Watt
but this only gets the wattage right now
Thanks in advance…
tom_l
April 14, 2023, 6:23pm
2
Use a template sensor to multiply your current and voltage to get power.
Use the Riemann Sum integration to integrate your power sensor with respect to time to get energy:
Be careful which method you pick. Nine times out of ten the left method is better than the default trapezoidal method.
1 Like
DrXtreme
(Sofian Benissa)
April 14, 2023, 8:32pm
3
Ok So I added a helper of type integration and set it to be hourly, it automatically says these are Ah values.
Then in a markdown card I had this:
## Power Meter
Now: {{ states('sensor.watermotor_gridcurrent') | float * 220 | round()}} Watt
This Hour: {{ states('sensor.power_usage') | float * 2.20 | round(default=0)}} KWH
Today: {{ states('sensor.power_daily_usage') | float * 2.20 | round(default=0)}} KWHD
Which looks like it works ok (I have to wait to accumulate more data).
BUT the first line shows values such as: 123.2000000000002 Watt
So it won’t round and it’s driving me crazy haha.
@tom_l
tom_l
April 14, 2023, 8:35pm
4
DrXtreme:
220 | round()
You are rounding the number 220.
Put some parentheses around the whole expression, then round.
Now: {{ ( states('sensor.watermotor_gridcurrent') | float * 220 ) | round()}} Watt
1 Like
DrXtreme
(Sofian Benissa)
April 14, 2023, 9:28pm
5
@tom_l Thank you so much now it works with rounding of values
1 Like