Energy dashboard: example Fronius Gen24 & BYD storage
The Home Assistant Energy Dashboard shows all relevant energy data in a complete overview. Performance data from a wide range of manufacturers or components can be used as the basis for the dashboard. Only sensors with the corresponding performance data are required to supply the interface with data.
Initial setup
The energy dashboard is set up under "Settings", "Dashboards", "Energy":
The dashboard can be operated with sensors for the electricity grid: consumption and feed-in, with details on power generation from one or more inverters, as well as the performance data of a battery storage unit. Gas consumption, water consumption or power consumption of individual appliances can also be visualized.
So far so simple, but to be used in the Energy Dashboard, the sensors must meet certain criteria
Sensor requirements
The Energy Dashboard can use sensors with the property "state_class: total_increasing". The performance data for power consumption, feed-in, solar panels, battery storage or individual devices also require the unit ( unit_of_measurement) Wh or kWh and the device class (device_class) Energy:
- state_class: total_increasing
- unit_of_measurement: Wh or kWh
- device_class: energy
A look at the developer tools / states tells us whether the sensor is ready for use in the energy dashboard:
Details on the properties and the database tables behind them, see: HA history: more than 10 days? Long Time Statistic (LTS)
The devil is in the detail
My setup consists of a smart meter, a Fronius Gen24 inverter with 2 strings: east/west and a BYD HVS battery. I also use a Hoymiles microinverter for the PV panels on my balcony.
Depending on how the sensors of the respective integrations are available, these may need to be prepared via a helper. As an example, the Fronius integration for the Gen24 inverter provides a total meter for all the energy produced: unfortunately, this includes the energy drawn from the battery. This means that the energy meter of the inverter cannot be used for the PV power of the panels in the "Solar panels" dashboard. According to the official Home Assistant documentation, battery systems are not supported:
Fronius Integration: "Battery systems" are not directly supported.
The official Home Assistant documentation recommends the use of a "Riemann Sum Integral Sensor" helper for the PV panels.
The sum integral sensor has a decisive disadvantage at this point: if Home Assistant is not available - even if only for an upgrade to a newer version - the sensor would not count the energy generated in the meantime. For this reason, I try to avoid the summation integral sensor as much as possible and prefer to use totalizers. In the case of the Fronius Gen24 inverter, the Modbus API also provides the total PV power generated by the panels for each MPPT tracker. The HACS integration "SunSpec" can be used to access the Modbus values as easily as possible:
For details on Modbus setup and Sunspec, see: Fronius: Data & settings via the network (Modbus).
The values relevant for the Energy Dashboard are provided by the device: "Multiple MPPT Inverter Extension Model":
The entity: Module 0 Lifetime Energy (sonsor.fronius_mppt_module_0_lifetime_energy) reflects the total generated energy of String 1 and Module 1 Lifetime Energy reflects the energy of String 2:
The entities can be included in the dashboard either directly and individually, or summarized via a helper. After initially integrating the PV panels without a battery via the total counter of the inverter and wanting to continue the statistical data, I combined the two MPPT values into one entity via a helper sensor:
Source code for the status template:
{{ (states("sensor.fronius_mppt_module_0_lifetime_energy") | float + states("sensor.fronius_mppt_module_1_lifetime_energy") | float) }}
Integrated here in the energy dashboard:
If you prefer to use the two strings separately in the energy dashboard, you can alternatively use string 1 and string 2 by adding sensor.fronius_mppt_module_0_lifetime_energy and sensor.fronius_mppt_module_1_lifetime_energy:
and
Lifetime for modules 2 and 3: Battery charging and discharging:
The two MPPT Lifetime values of Module 2 and Module 3 collect the total charge and discharge energy of the battery:
Module 2 counts the energy with which a connected battery was charged and Module 3 the total energy that was drawn from the battery. In an older Gen24 firmware version, the values for Module 2 and 3 were not always available, which is why I recommended a template sensor and automatic recharging of the Sunspec integration on this page. The problem was solved in mid-2024 with a firmware update of the inverter, which means that the workarounds are no longer necessary today. The use of the Riemann summation integral sensor is also no longer needed.
With the latest firmware, the sensor "'sensor.fronius_mppt_module_2_lifetime_energy" can be used directly as a total counter for the battery charge in the energy dashboard, 'sensor.fronius_mppt_module_3_lifetime_energy' as discharge power:
Sources
- Home-Assistant integration Fronius: https://www.home-assistant.io/integrations/fronius/
- Github Issue Sunspec: "Fronius temporariliy "unavailabe" data on MPPTs 2 and 3, used for the battery": https://github.com/CJNE/ha-sunspec/issues/138
Conclusion
The Home Assistant Energy dashboard is great, especially as all relevant data for energy consumption and energy generation can be processed with very little effort. Compared to the web interface of certain inverter manufacturers, Home Assistant supports a wide range of manufacturers and also the possibility of evaluating the performance data of a wide range of consumers.
{{percentage}} % positive