I have MQTT on my Pico W working when I connect to public MQTT brokers at "broker.hivemq.com", "broker.emqx.io" and "test.mosquitto.org".
It also works when I connect to "192.168.0.130", which is my Pi 3B running a local 'mosquitto' broker, with hostname "Pi3B".
That matches all the example code I have seen which either connects to a cloud URL or a Pi host using a pre-defined IP Address.
But I found nothing which showed connecting to a local MQTT broker when the host's IP Address isn't known.
Given the Pico W MQTT client doesn't appear to handle 'mDNS', so "Pi3B.local" doesn't succeed, just errors - how do I discover the IP Address of the Pi or other host running the MQTT broker, what's the best practice ?
There are some suggestions from Raspberry Pi here -
Find the IP address of your Raspberry Pi - https://www.raspberrypi.com/documentati ... ip-address
(But since the OP is normally insightful and resilient I may be missing some deeper significance to the question... )
Statistics: Posted by B.Goode — Tue Jul 23, 2024 12:48 pm