Home Assistant Energy Management in 2021.8.0 not showing all devices with power monitoring (zigbee2mqtt)
In newest release of Home Assistant there is cool new feature called Energy Management which adds dedicated dashboard when you can monitor all your devices that can do such measurment, mostly smart sockets.
This should work out of the box, and generally it is working, but in my case I was able to add only wifi smart sockets with Tasmota.
However all my zigbee sockets which i have in HA via Zigbee2MQTT ware missing from configuration fo Energy management, and of course I wanted to have it for complete statistics. Especially that whole my HQ in home is on one of these, and also ASA that I mentioned earlier in this post is controlled by zigbee socket.
It turns out that fix is rather simple but not obvious. Device to be able to show on Energy Management settings besides all wattage atributes have to have three more attributes which are:
- Device classs with value of energy
- State class with value of measurement
- Last_reset with value of date and time, it is safe to set it to something like "it was never reset before" so value of 1970-01-01T00:00:00+00:00 is good.
How to configure it? First you have to turn Advanced mode, which is located under your profile - see the below screenshot for details:
Then go to Configuration and at the bottom to customizations:
Now You have to find entity that is not shown on Energy tab and check what is missing. As shown below, I have Device class, but missing State class and Latest reset.
After checking "pick an attribute to override" it turns out state_class is present but not set. Last reset I will add as "Other" type.
Finally it should look like this. Click Save after adding.
You can choose other entity and go back to previous one to verify that attributes are set. If are correctly added to customize.yaml it should appear on top.
Going to Configuration, then Energy, and clicking Add Consumption should reveal new device:
Then after some time readings should appear on Energy Dashboard.