Integrate MQTT Sensor in Energy Dashboard

Hi there. After buying a couple of shelly 2.5 for my roller blinds I installed home assistant to my synology nas. Now I want to integrate any useful devices in my household step by step.

My photovoltaic system with battery (Samsung/Hansol AIO 5.5) pushes all data to its own cloud, which is useless to me. After portscanning its IPA I found a webserver running on a high port. With help from Hat schon jemand Erfahrung mit dem Samsung SDI ESS? - Stromspeicher (Netzparallel) - Photovoltaikforum I wrote a python script that reads some data like consumptation or feed in and log it to a mariadb Database.

So far so good.

To integrate my own script and somehow my pv system into home assistant I wrote a python mqtt client and push the data to a mqtt broker (the same as logging into db). HA recognized these new sensors and gave me some new entities.

But I’m not able to add these sensors to the energy dashboard. I spend several afternoons (and nights) with googling, reading, trying, programming, deleting, flipping table, hair tussling, and so on but nothing works.

Since it is my own work, I can change the mqtt messages as I like.

I use Home Assistant 2021.9.7 as package from GitHub - SynoCommunity/spksrc: Cross compilation framework to create native packages for the Synology's NAS on Synology NAS DSM7 (ARM7)

A sensor for testing purposes (mqtt topic homeassistant/sensor/qhome_test/config)

{
  "name": "Test4Energy",
  "unique_id": "qhome_test",
  "device": {
    "manufacturer": "Samsung",
    "model": "ELSR552-00001",
    "name": "ESS 5.5 AiO",
    "identifiers": [
      "AR0XXXXXXXXXXXXXXX"
    ],
    "sw_version": "V04.01 ,GER, Jun  9 2017"
  },
  "device_class": "energy",
  "unit_of_measurement": "kWh",
  "state_topic": "qhome/state",
  "value_template": "{{ value_json.test}}",
  "state_class": "total_increasing",
  "last_reset_topic": "qhome/state",
  "last_reset_value_template": "{{ value_json.last_reset}}"
}

Example values (Topic qhome/state)

{
  "date": "2021-12-11 22:13", 
  "battery": 0.0, 
  "pv": 0.0, 
  "demand": 0.3785, 
  "feedin": 0.0, 
  "load": 0.3785, 
  "temp": 31.2, 
  "test": 202112112213.0, 
  "last_reset": "1970-01-01T00:00:00+00:00"
}

Note: I use the local timestamp as kWh for testing purposes, since it increases reliably every minute.

Do you have any idea what I’m missing?

Solved this issue by adding following lines to configuration.yaml

utility_meter:
  feedin_battery:
    source: sensor.feedin_battery
    name: QHome Feedin Battery
    cycle: daily
  demand_battery:
    source: sensor.demand_battery
    name: QHome Demand Battery
    cycle: daily
  feedin_grid:
    source: sensor.feedin_grid
    name: QHome Feedin Grid
    cycle: daily
  demand_grid:
    source: sensor.demand_grid
    name: QHome Demand Grid
    cycle: daily
  photovoltaic:
    source: sensor.photovoltaic
    name: QHome Photovoltaic
    cycle: daily

These sensors were available on energy dashboad.

1 Like