Hi.
I have a new Shelly 3EM that monitors power consumption of my heat pump. The heat pump is a 3-phase pump and I want to see the overall consumption of the pump. So I have a template that calculates power and energy of all three phases together into one new sensor.
- name: "Overall Power"
unit_of_measurement: "W"
device_class: power
state: >
{{ [ states('sensor.faze1_hneda_power_3'),
states('sensor.faze2_cerna_power_3'),
states('sensor.faze3_seda_power_3') ]
| map('float') | sum }}
availability: >
{{ not 'unavailable' in
[ states('sensor.faze1_hneda_power_3'),
states('sensor.faze2_cerna_power_3'),
states('sensor.faze3_seda_power_3') ] }}
- name: "Overall Energy"
unit_of_measurement: "kWh"
state_class: measurement
device_class: energy
state: >
{{ [ states('sensor.faze1_hneda_energy_3'),
states('sensor.faze2_cerna_energy_3'),
states('sensor.faze3_cerna_energy_3') ]
| map('float') | sum }}
availability: >
{{ not 'unavailable' in
[ states('sensor.faze1_hneda_energy_3'),
states('sensor.faze2_cerna_energy_3'),
states('sensor.faze3_cerna_energy_3') ] }}
But to be able to use it the energy dashboard, I had to also customize it and provide last_reset info
With that, I was able to add the custom sensor to the energy dashboard, but it does not show any data even after a day. But when I read the data manually from the sensor via Developer Tools, it has the correct value in it.
Any idea why I don’t see the data on the energy dashboard?
Hi, can you please elaborate a bit…
when I add state_class to my template sensor, it is refused by HA…hence I felt forced to use a two-sensor approach
- platform: template
sensors:
gosund_1_consumption:
friendly_name: "GosundPlug1 current consumption"
unit_of_measurement: 'W'
device_class: power
state_class: total_increasing
value_template: "{{ states.switch.gosundplug1.attributes.current_consumption }}"
results in:
“Invalid config for [sensor.template]: [state_class] is an invalid option for [sensor.template]. Check: sensor.template->sensors->gosund_1_consumption->state_class. (See ?, line ?).”
So I found out that I was using the old way of templating
I managed to change it into this below but it is not shown for the Energy dashboard …any idea what I am doing wrong?