@Jose-Manuel The error you're encountering (getaddrinfo() returns 202) typically indicates a DNS resolution issue, meaning the M5Tough is unable to resolve the hostname uiflow2.m5stack.com. Here are some steps to troubleshoot and resolve the issue:
- Check Network Connection
Ensure the M5Tough is connected to a stable Wi-Fi network.
Verify the Wi-Fi credentials (SSID and password) are correctly configured.
- Verify DNS Settings
If the device is unable to resolve the hostname, try using a different DNS server (e.g., Google's DNS: 8.8.8.8 or 8.8.4.4).
You can configure this in the Wi-Fi settings or DHCP settings of your router.
- Test Connectivity
Use a tool like ping or nslookup to check if the hostname uiflow2.m5stack.com is resolvable from another device on the same network.
- MQTT Configuration
Ensure the MQTT broker settings (hostname, port, client ID, etc.) are correctly configured in your code.
If the broker requires authentication, verify the username and password.
- Firmware Update
Ensure the M5Tough is running the latest firmware. Outdated firmware might have bugs related to network connectivity.
- Debugging
Add debug prints in your code to check the Wi-Fi and MQTT connection status before attempting to send messages.
Example:print("Wi-Fi connected:", wifi.isconnected())
print("MQTT connected:", mqtt.isconnected())
- Alternative MQTT Broker
Temporarily switch to a public MQTT broker (e.g., test.mosquitto.org) to rule out issues with the uiflow2.m5stack.com server.
Example Code for MQTT Connection (MicroPython)
from umqtt.simple import MQTTClient
import network
Wi-Fi Configuration
wifi = network.WLAN(network.STA_IF)
wifi.active(True)
wifi.connect("YOUR_SSID", "YOUR_PASSWORD")
Wait for Wi-Fi connection
while not wifi.isconnected():
pass
print("Wi-Fi connected:", wifi.isconnected())
MQTT Configuration
mqtt = MQTTClient("client_id", "test.mosquitto.org", port=1883)
mqtt.connect()
print("MQTT connected:", mqtt.isconnected())
Suggested Next Steps
If the issue persists, you can contact M5Stack support at support@m5stack.com for further assistance.
reply with https://chat.m5stack.com/