This example connects to a local MQTT broker and publishes a message to a topic once a second. It makes use of UnoWiFiDevEdSerial1 and WiFiEspAT with persistent WiFi settings to send DHT sensor readings to the MQTT broker using Arduino MQTT library.
It was tested successfully on a local Home Assistant implementation.
The circuit:
- Uno WiFi Dev Ed board
- DHT22 (AM2302)
This example code is in the public domain.