This is meant as a howto to integrate the following fronius components into the energy dashboard of HA 2021.12+:
- Fronius Symo Hybrid
- Fronius Smart Meter
- BYD Battery
The integration is based on the new UI config with Fronius - Home Assistant
The config is like this:
The following items are directly from the fronius integration:
- Grid consumption: Energy real consumed
- Return to grid: Energy real produced
The solar panel and battery need to be built with template and Riemann sum integration:
template:
- sensor:
- name: "Battery Power Charging"
unit_of_measurement: W
device_class: power
state: "{{ max(0, 0 - states('sensor.power_battery_fronius_power_flow_0_192_168_178_48') | float(default=0)) }}"
- name: "Battery Power Discharging"
unit_of_measurement: W
device_class: power
state: "{{ max(0, states('sensor.power_battery_fronius_power_flow_0_192_168_178_48') | float(default=0)) }}"
- name: "Power Photovoltaics"
unit_of_measurement: W
device_class: power
state: "{{ states('sensor.power_photovoltaics_fronius_power_flow_0_192_168_178_48') | float(default=0) }}"
sensor:
- platform: integration
source: sensor.battery_power_charging
name: "Total Battery Energy Charged"
unit_prefix: k
method: left
- platform: integration
source: sensor.battery_power_discharging
name: "Total Battery Energy Discharged"
unit_prefix: k
method: left
- platform: integration
source: sensor.power_photovoltaics
name: "Total Photovoltaics Energy"
unit_prefix: k
method: left
Explanation: The battery energy is not counted at the inverter, thus needs to be integrated from the power flow to and from the battery (negative means charging, positive means discharging). All defaults are added as the sensor turns unknown if the battery is in standby when empty.
The photovoltaics energy also needs to be integrated via Riemann sum, and while at it, also set that to 0 as the source from the power flow (sensor.power_photovoltaics_…) turns unknown at night.
The method is set to “left” for all the integration, as the graphs can be quite spikey (0, 2kW, 0), see:
In case you have an appliance which produces spikey consumption (like an on/off electrical boiler) you should opt for the
left
method to get accurate readings.
(from Integration - Riemann sum integral - Home Assistant)
Important: If there is a battery involved (as in this howto), the “Total energy” from the inverter cannot be used for the solar panels, as both energy from solar as well as energy from the battery is counted on the “Energy total” from the fronius component.
With that energy usage and distribution on a day with both direct usage and charging / discharging of the battery should look like this: