Update: I was able to bypass the need for running home assistant in host networking mode by using the macvlan network driver.
This allowed me to re-enable mDNS discovery in TrueNAS and still have auto-discovery in Home Assistant.
I removed:
network_mode: host
and added
services:
homeassistant:
...
networks:
homeassistant:
ipv4_address: 192.168.0.242
...
networks:
homeassistant:
driver: macvlan
driver_opts:
parent: br0
ipam:
config:
- subnet: 192.168.0.0/24
ip_range: 192.168.0.240/29
gateway: 192.168.0.1
aux_addresses:
host: 192.168.0.241
(to use br0 you need to have a bridge interface configured on TrueNAS)
To be able to access services on the host, create and configure a macvlan by running these commands on the host:
ip link add ha-host-shim link br0 type macvlan mode bridge
ip addr add 192.168.0.241/32 dev ha-host-shim
ip link set ha-host-shim up
ip route add 192.168.0.240/29 dev ha-host-shim
Change the subnet to the one used in your local network of course.
And don’t forget to make the last series of command persistent by adding it to Postinit scripts.