Use Homeassistant MQTT Sensor for Energy Dashboard
Introduction:
I want to say Intermediate use MQTT in Homeassistant to track total consumption. With normal import, however, I could not select the sensor. In the following, I would like to briefly show, which could fix the problem. In my case, correct categorization has fixed the error.
In the I had shown how to add MQTT sensors in Homeassistant.
Unfortunately, these sensors cannot be used in the Enegerydashboard by default, so I will show how to fix this problem. IMPORTANT: With me the categorization of the sensor was the solution, but it doesn't have to be the same with you.
actual state of the sensor
At the moment the sensor in the config.yaml looks as follows:
- platform: mqtt name: "mainEnergyMeterTotalConsumptionForwardKwh" uniqueid: sensor.mainenergymetertotalforwardconsumptionkwhnew statetopic: mainPowerMeter/forwardenergy/counted/total unitof_measurement: "kWh"
Adjustment of sensor:
In this case, I would like to integrate my EnergyMeter if a different system or another type of sensor is to be integrated, the KJonfiguration must be adapted to the respective sensor. More information here, here and here .
My sensor looks like the following:
- platform: mqtt name: "mainEnergyMeterTotalConsumptionForwardKwh" uniqueid: sensor.mainenergymetertotalforwardconsumptionkwhnew statetopic: mainPowerMeter/forwardenergy/counted/total unitofmeasurement: "kWh" device: configurationurl: http://192.168.1.76/ identifiers: "nodework.mainEnergyMeter01" deviceclass: energy stateclass: total
Important here are the keys “deviceclass and “stateclass”. The attribute “deviceclass” must be energy in my case as I integrate my intermediate current meter and as stateclass I chose “total” as my measured value is an absolute value and represents current consumption (in kWh). If I track my live consumption, the class would be “measurement”.
With me, the class “total_increasing” would also be possible, as the measured value should only rise, but I do not yet know if a later balcony power value can go negative when fed in.
After adjustment, Homeassistant must be restarted and then the sensor should appear in the dropdown.
Back…