Hi,
The key is to tell HA what the units are for the sensor, otherwise long term statistics may not plot a graph (as it doesn’t know what the value represents - even just a “number”).
I’d use the search on this forum as there are many posts about developing using MQTT including…
You’ve got it in one - same HASS discovery as Tasmota (well, pre v-12 SetOption19 0 that is).
The hardware is based on a RPi Zero and a Pimoroni Grow hat running Python.
Note - due to the shortage of RPi, Pimoroni have produced a new version based on the new RPi PicoW uP. Not looked if the uP has microPython Paho MQTT support.
The code is a fork of Pimoroni’s example code with MQTT support added for both sensor publish and motor control using the Paho MQTT client. It should really be up in Gi…
Note to developers - Whilst you’re re-factoring your MQTT Discovery code, can I suggest adding additional values to improve how users can interact with your hardware?
Here’s an example from my own test code (with some light changes) which adds:
The example Device is configured with optional extra information such as manufacturer, version, and the ‘suggested_location’ which can be used to set the Area.
The example Entity adds optional extra values such as an icon, the device class and unit of …
If this helps, this post!