just joined the group of users to this great project.
I have implemented MQTT sensor and binary sensor, but would like them to support the knowledge of batterylevel… how is it possible to add this attribute.
The topic can be the same - just a different message that could be {“voltage” : 3.3}
You could do it that way, if your sensor also uses json format. I would just include the battery level in every message it sends by {"your_sensor": "on", "voltage" : 3.3}
Or alternatively, send a message with a different topic for the battery level without json formatting in the message.
I’m sorry but I misread your original question. All my battery levels are in separate sensors. I don’t know how to add an attribute to a sensor.
From what I can see, you have to create template sensor from the attribute in order to use the value anyway, so I don’t see a great advantage in doing it.