Update:
The title has been updated as the root cause of the problem was not AppDaemon. It seems I got caught out by the latest auto-update of the hassio_supervisor. It was this update that introduced core-dns. I reverted to an earlier state (luckily the docker server is actually a Smartos KVM and I simply rolled back the ZFS datasets) and followed the instructions in #43
I’ll leave this here for archival purposes only.
This may well be a “well-known-gotcha”, but it wasn’t known to me.
TL:DR
When you install the appdaemon container, a dns container is also installed. Unfortunately, the latter doesn’t show up in the hassio dashboard.
If you use full internet domain names in your local network (e.g. mqtt.mydomain.net) rather than (e.g.) mqtt.local, DNS name resolution in the homeassistant container will fail because the homeassistant container will start to use the newly installed dns server; and this dns server defaults to using google’s upstream dns servers rather than your local dns server. Thus, dns lookups for mqtt.mydomain.net will fail. You need to expose the dns container in the hassio dashboard and change its configuration to point to your own dns server.
Background
I have a new hassio installation inside an existing docker server. My local network uses full internet domain names of the form host.mydomain.net and these are resolved using an internal dns server on the address 172.29.1. All devices on the internal network use this internal dns server.
The Problem
HA worked fine, able to resolve mqtt.mydomain.net, unifi.mydomain.net etc, until I installed appdaemon so I could use schedy. At this point, the mqtt devices and sensors stopped working, as did the unify sensors.
When I ssh’d into the docker server, I could see that there was an additional amd64-hassio-dns
docker container that wasn’t there before. (I presume this was installed alongside appdaemon to provide DNS for the docker environment, though I could find no mention of it in the appdaemon documentation).
When I looked at the config for this container (in /usr/share/hassio/dns/corefile
) it showed
.:53 {
log
hosts /config/hosts {
fallthrough
}
forward . dns://1.1.1.1 dns://8.8.8.8 {
health_check 10s
}
}
i.e., the docker dns server was bypassing my local dns server and going straight to google to resolve un-resolved names. Of course, google knows nothing of mydomain.net.
Now, I could have modified the json directly, but I was concerned that this might get overwritten by an upgrade, so I went back to HA and installed the dns-masq hassio addon. This exposed the dns server’s config in the hassio dashboard and I modified it to be
.:53 {
log
hosts /config/hosts {
fallthrough
}
forward . dns://172.29.12.1 dns://1.1.1.1 dns://8.8.8.8 {
health_check 10s
}
}
where 172.29.12.1 is my internal dns server.
After rebooting the whole docker server, my mqtt devices re-appeared.
I hope this helps somebody else.