Hi all,
I’m currently working on developing a custom addon that acts like a broker (http+mqtt) for Meross devices. For that purpose, I’d like to make that mqtt/http api services to be “advertised” on the local lan with mDNS. I tried to do so by setting host_network=“true” (within the config.json) and added avahi daemon on my addon. Despite from the logs it looks like it’s working, it is not (I am unable to see the entry with bonjour clients on the LAN). From the logs I can see the following log line being printed: WARNING: Detected another IPv4 mDNS stack running on this host. This makes mDNS unreliable and is thus not recommended.
My question is: how can I implement mDNS discovery from within my custom addon? Is there any example you can provide?
Did you manage to advertise the MQTT service? I’m trying to get the Mosquitto broker advertised. It seems we must use the HA internal helper APIs to access the running Zeroconf and AsyncZeroconf instances.
Here is a simple python script that gives you access to the zeroconf instance of HA for anyone interested. To run it, you need HACS and Pyscript integration.
Hi
I’m new to this. I’ve got HACS and pyscript installed, and can put your code in a py file in the pyscript folder, but then what?
How do I run it, and does it have to run just on startup or how?
This would be good to get going as I have had to hard code the MQTT server address in my esp8266’s because they can’t resolve hostnames from mDNS, only services.
Thanks very much in advance.