Hi everyone,
I have a P1 meter that registers the engergy consumption (electricity and gas)
The hardware device (although not relevant here): HomeWizard Wi-Fi P1 Meter
I connected this to my HA-instance with the “P1 meter - HomeWizard Energy” integration.
Data are nicely displayed in the Energy card.
Because I want to see the total energy in kWh, I created a template sensor as follows:
template:
- sensor:
- name: "P1 meter Total Gas kWh"
unique_id: "sensor.p1_meter_total_gas_kwh"
icon: mdi:gas-cylinder
unit_of_measurement: "kWh"
device_class: energy
state_class: total_increasing
state: >
{% set gasm3 = states('sensor.p1_meter_total_gas') | float %}
{{ (gasm3 * 10.2346) | round(2, default=0) }}
This sensor converts the m3 to kWh.
To sum things up in the Energy card: I configured my gas consumption (in m3) also as “solar energy” (in kWh). By doing this you get following result:
- (1): Electricity consumption of today
- (2): Gas consumption (in kWh) of today (as you can see, this is 7.3m3 * 10.2346, as defined in my template sensor)
- (3): Total consumption (in kWh)
so far so good!
However,
“sometimes”, the calculation of daily energy (kWh) fails totally:
You can see here
- (1) Gas consumption (kWh). But on 03/03 and 05/03 the value is about 33.000 kWh!!!
- (2) Gas consumption (m3)
If everything went well, (1) should equal (2) * 10.2346
For some reason, the energy card does not display the daily energy consumption on that specific day, but the absolute value of my “sensor.p1_meter_total_gas_kwh”.
Indeed:
The template sensor “sensor.p1_meter_total_gas_kwh” registers the total amount of energy
For some reason, HA interprets the calculated value wrong sometimes. Note that the error does not occur on Gas (m3)!
This problem probably has nothing to do with the hardware and/or integration: I have 2 other instances of HA running on my same network, and also connected to the P1 meter with the same integration. On those instances, the same problem occurs from time to time, but on other times.
What am I doing wrong?
Is there some secret that I have to configure in my template sensor?
any help is appreciated!
Kind regards,
Bart Plessers