Hi everyone
I am getting aqainted with Home Assistant and need to achieve something that is completely over my head. I have read some of the documentation and even consulted ChatGPT, with no success.
My Fronius Smart Meter is in the consumption path, and I know I need to do the following in order for the energy dashboard to be accurate:
- The
Power grid
entity provided by the Fronius API is positive on import and negative on export. Split it up into import- and export-power entities by using helpers with templatesmax(states('sensor.solarnet_power_grid') | float, 0)
andmax(0 - states('sensor.solarnet_power_grid') | float, 0)
. - Then use [Riemann sum] to integrate these import-/export-power entities into energy values (kWh).
- Use these energy entities for
Grid consumption
andReturn to grid
in the energy dashboard configuration.
This is what I have done:
template:
- sensor:
- name: "Power Grid Import"
unit_of_measurement: W
device_class: power
state: "max(states('sensor.solarnet_power_grid') | float, 0)"
- name: "Power Grid Export"
unit_of_measurement: W
device_class: power
state: "max(0 - states('sensor.solarnet_power_grid') | float, 0)"
sensor:
- platform: integration
source: sensor.power_grid_import
name: "Total Power Grid Import Energy"
unit_prefix: k
method: left
- platform: integration
source: sensor.power_grid_export
name: "Total Power Grid Export Energy"
unit_prefix: k
method: left
Unfortunately, Home Assistant gives me these errors:
statistics_not_defined
- sensor.total_power_grid_import_energy
Entity unavailable
The state of these configured entities are currently not available:
- sensor.total_power_grid_import_energy (unknown)
Unexpected device class
The following entities do not have the expected device class:
- sensor.total_power_grid_export_energy
I have included some sensor state screenshots below. Any advice would be appreciated. Thank you in advance.