Hi
I’m trying to add some energy measurements done by an ESP32 and sent over MQTT to the HA energy dashboard, using MQTT autodiscovery for creating the sensors. Somehow I managed to get this working on 2021.6, but when I revisited this project on 2021.11 I could not get it working any more.
I create the sensor by sending {"name": "house total energy", "device_class": "energy", "state_class":"measurement", "unit_of_measurement":"kWh", "state_topic": "homeassistant/sensor/house_total_energy/state"}
to homeassistant/sensor/house_total_energy/config
.
This succesfully creates the sensor and it displays the state updates on the states page. On the energy dashboard however, it’s not available for selection.
I’ve tried adding "last_reset": "1970-01-01T00:00:00+00:00"
, "last_reset_topic": "homeassistant/sensor/house_total_energy"
and "unique_id":"house_energy"
to the payload, and changing "state_class"
to "total_increasing"
, but to no avail.
I can’t see anywhere in the docs what I could be doing wrong. Is perhaps something missing in the MQTT autodiscovery?