I have finally got a working config with three PZEM004T monitoring my boiler/heater to report the fundamental data through an Esp32 set up in esphome.
However, I fail to get an accumulated energy sensor to be available for the HA Energy dashboard. I can get the separate L1, L2 and L3 energy readings into the Energy dashboard, but not the template sensor.
I have looked at a few other examples in the community but neither of them have solved the problem, so what am I doing wrong?
I am expecting either either/both bvp_energy or bvp_energy_2 to be avialable to add to the Energy dashboard…
excerp of configuration.yaml:
- platform: integration
source: sensor.bvp_power
name: bvp_energy_2
unit_prefix: k
unit_time: h
round: 2
type or paste code here
...
- platform: template
sensors:
bvp_current:
friendly_name: "BVP Current"
# unique_id: bvpcurrent
entity_id:
- sensor.bvp_l1_current
- sensor.bvp_l2_current_2
- sensor.bvp_l3_current_2
value_template: "{{ (states('sensor.bvp_l1_current')|float + states('sensor.bvp_l2_current_2')|float + states('sensor.bvp_l3_current_2')|float)|round(3) }}"
unit_of_measurement: "A"
icon_template: "{{'mdi:current-ac'}}"
- platform: template
sensors:
bvp_power:
friendly_name: "BVP Power"
unique_id: bvp_power
entity_id:
- sensor.bvp_l1_power
- sensor.bvp_l2_power_2
- sensor.bvp_l3_power_2
value_template: "{{ (states('sensor.bvp_l1_power')|float + states('sensor.bvp_l2_power_2')|float + states('sensor.bvp_l3_power_2')|float)|round(3) }}"
unit_of_measurement: "W"
# icon_template: "{{'mdi:flash'}}"
device_class: power
- platform: template
sensors:
bvp_energy:
friendly_name: "BVP Energy"
unique_id: bvp_energy
entity_id:
- sensor.bvp_l1_energy
- sensor.bvp_l2_energy_2
- sensor.bvp_l3_energy_2
value_template: "{{ ((states('sensor.bvp_l1_energy')|float + states('sensor.bvp_l2_energy_2')|float + states('sensor.bvp_l3_energy_2')|float))/1000|round(3) }}"
unit_of_measurement: "kWh"
# state_class thows error when checking config
# state_class: total_increasing
device_class: energy
# icon_template: "{{'mdi:lightning-bolt'}}"