mirror of
https://github.com/crankyoldgit/IRremoteESP8266.git
synced 2026-01-12 00:05:10 +08:00
The MQTT broker can change address if its IP is not static.
Add MQTT_SERVER_AUTODETECT_ENABLE option which detects the broker that
advertises the service _mqtt._tcp
If the broker changes address it won't be a problem. If the broker
doesn't advertise the service, then use the pre-configured IP as before.
Example testing on Debian:
```bash
$ apt install mosquitto avahi-daemon
$ cat <<EOT >> /etc/mosquitto/conf.d/my_broker.conf
listener 1883 0.0.0.0
allow_anonymous true
EOT
$ cat <<EOT >> /etc/avahi/services/mqtt.service
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h</name>
<service protocol="ipv4">
<type>_mqtt._tcp</type>
<port>1883</port>
</service>
</service-group>
EOT
$ systemctl start mosquitto
$ systemctl start avahi-daemon
```
Co-authored-by: Helen Koike <helen@koikeco.de>
Co-authored-by: David Conran <crankyoldgit@users.noreply.github.com>