Files
IRremoteESP8266/examples/IRMQTTServer
Helen Koike c053aa58a8 IRMQTTServer: add MQTT_SERVER_AUTODETECT_ENABLE via mqtt mDNS (#1769)
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>
2022-03-08 09:49:35 +10:00
..