Adding Missing Attributes to Sensor for Tasmota Electric Meter Device

After even more searching, trial and error, and burning the midnight oil, I managed to get it to work :slight_smile:

Just in case anyone else is stuck with this, here is what I had to do:

  1. Determine the right state_topic (including path) to enter. In MQTT Explorer, I found two: one that started with tasmota/discovery and another that started with tele. Since most examples in other people’s questions contained tele, I assumed that was the right one. Ironically, it was only the tasmota/discovery path that worked when I tried listening to this topic in the Mosquitto broker integration in HA. I still don’t understand what the difference is between the two. The tele option seemed to give more up-to-date values, though.

  2. The other problem, which I glossed over initially, was the crucial importance of value_template. Without this, I don’t think it would ever have worked. The json payload from the two paths I mentioned above were of course different, so more trial and error. In the end, the following sources helped me to figure out what I needed to enter as the value_template: MQTT, extract data from energy meter - json - #2 by myle (expland the response!) and Templating - Home Assistant

My Energy Dashboard is a little bare at the moment, so it’s time to add more sensors :wink: