#Google Assistant Local Fulfillment in Docker w/o host networking

1 messages · Page 1 of 1 (latest)

fallow spade
#

Sorry for the double ping, I realized my big block of text should be in a thread...

I stumbled across your message searching for something else.
What you are asking for can be done, you need to attach your home assistant docker container to a Docker Macvlan network to give it an IP address on your host machine's (LAN) subnet so it can properly communicate using mDNS.

One downside of this is that you have to either segment your network and allow docker to use an IP range on the host network, or you can assign the container a custom IP and mac address and reserve the IP for the container in your router.
Another downside is your host machine cannot communicate with devices in the Macvlan network via ssh, docker.host.internal, etc, however you can still expose ports on a container in a macvlan to the host.

An alternative to a macvlan network would be using a program called avahi reflector in docker to reflect the mdns packets between the docker subnet and your host machine's subnet. I can't quite remember why I switched away from this approach but it is a rather hairy approach compared to using a macvlan network in docker.

Just a heads up, if a container in docker has multiple networks attached, the main gateway for the container is the network that comes first in the alphabet. So you should make your Macvlan network something like AAA_macvlan to ensure home assistant uses that as it's primary network.

#

Of course, you should only use the macvlan network approach if your LAN is trusted, since it effectively makes your home assistant instance it's own device on your LAN network.

bronze wigeon
#

Hey @fallow spade , appreciate the reply. I already have Avahi running in reflector mode for Apple Homekit which works (yes, I'm running both Apple Homekit and Google Home 😅). I can see the _home_assistant._tcp. mDNS packet(?), but it has the wrong IP. In the Homekit integration there is an option to set the advertisement IP (https://www.home-assistant.io/integrations/homekit/#advertise_ip), and in the Homekit mDNS packet I can see the proper IP being advertised, but in the Google Assistant one it's the internal Kubernetes IP.

Basically I need a way to change that IP to something else, whether it be through Avahi or Home Assistant directly if possible. I'd prefer not using Macvlans (or the Kubernetes alternative) if possible.

fallow spade
#

I'm not familiar with kubernetes but with docker your containers are generally on a subnet with IP addresses in the 172.16.0.0/12 range. The only way for home assistant to have an IP on your LAN network is using a Macvlan network in docker/kubernetes

#

one other thing I've noticed that you need to get local fulfillment to work is to go to home assistant network settings and remove any URL from the external access field. Only do this if you don't use nabu casa, or you only access your HA instance on LAN or via a reverse proxy. Having the external URL field set causes the https base_url to appear in the home assistant TCP mdns broadcasts, which appears to break local fulfillment.