My energy dashboard readings are way too high and I don’t know why!
I have an Open Energy Monitor system that gathers energy data measured at the solar inverter and grid meter. This system has been running for a few years and has served me well but I would like to display this data in Home Assistant Energy dashboard.
This data is ingested by an EmonCMS instance running on a raspberry pi and processed to generate instant power readings in watts, each of those power readings are logged and used to generate three cumulative readings of energy in kWh. These readings never reset and are published over MQTT.
The readings are:
total_energy - net total of all energy imported and exported
solar_energy - sum of all energy generated by the solar system
solar_export_energy - sum of all exports - this value was only created yesterday and so is much lower than the other readings
With some difficulty I have managed to get home assistant to recognise these energy readings with the following declarations in my configuration.yaml
sensor:
- platform: mqtt
name: "total_energy"
state_topic: "grid/energy_total"
unit_of_measurement: 'kWh'
device_class: energy
state_class: total
- platform: mqtt
name: "solar_energy"
state_topic: "grid/energy_solar"
unit_of_measurement: 'kWh'
device_class: energy
state_class: total_increasing
- platform: mqtt
name: "solar_export_energy"
state_topic: "grid/solar_export_energy"
unit_of_measurement: 'kWh'
device_class: energy
state_class: total_increasing
template:
- name: "use_energy"
unit_of_measurement: 'kWh'
device_class: energy
state_class: total_increasing
state: >
{% set grid = states('sensor.total_energy') | int %}
{% set solar = states('sensor.solar_energy') | int %}
{{ (grid + solar) }}
As I understand it, the energy dashboard requires energy readings in kWh, so I have configured it with the “use_energy” value for Grid Consumption, “solar_export_energy” for Return to grid and “solar_energy” for Solar production.
As you can see in the attached screenshots this does not produce valid readings, can anyone suggest what I’m doing wrong?
It almost seems like it was expecting instantaneous power reading rather than energy readings but the documentation seems very explicit that it wants energy sensors with units in kWh.
I have also attached a screenshot of my EmonCMS energy dashboard over the same period for comparison.
Cheers,
Phill