I am experimenting with Home Assistant on my smart home KNX installation. ETS5 runs fine with my MDT SCN-IP000.02 interface.
Windows PC and KNX interface IP address is on the same subnet, DHCP static assigned by Mikrotik router. Home Assistant installation seems fine, I can access the web interface (port 8123), and it connects with an Axis camera and the Mikrotik router.
I understand that Docker Desktop for Windows is assigning IP addresses from 172.17.0.0/16 (gateway 172.17.0.1), and then that subnet is NAT-ed to Windows PC address (192.168.11.51). Mikrotik API gets connected from the Windows PC IP address, so network routing is not the problem. BTW, I disabled the antivirus/firewall (Kaspersky).
The documentation specifies that Docker Desktop for Windows can not use –network host, so I am using port mapping “-p 8123:8123 -p 3671:3671 -p 3671:3671/UDP”.
Multicast seems not to be working, so I tried: knx: tunneling: host: 192.168.11.39 port: 3671 local_ip: 172.17.0.2
I get the following errors:
WARNING (MainThread) [xknx.log] Sending telegram failed. No active communication channel.
WARNING (MainThread) [xknx.log] Error: KNX bus did not respond in time (2.0 secs) to GroupValueRead request for: 0/0/14
… and so on.
I also tried local_ip 192.168.11.51, and “route_back: true:” options.
Home assistant container requires host networking mode to work properly. Use host networking | Docker Documentation Home Assistant needs host networking mode for discovery, bluetooth communications, and connections to many other integrations. You access Home Assistant on port 8123 but it opens and configures many different ports to work with other integrations and devices in the background.
Unfortunately as you pointed out above, docker host networking mode only works with linux based systems and won’t work with docker running on Windows or Mac. There are probably a lot of integrations that will work ok without host networking mode, but many that won’t, including multicast.
I don’t think this is ever going to work right for you because you’re not using a supported install method. The official install instructions state that to properly run home assistant on windows and avoid issues, you need to install a virtual machine. See the documentation below for more details.
Thanks Docker on Windows is kind of Linux, but not fully. I will try to find the solution before I move to a VM or proper Docker. Re parametare I tried: knx: tunneling: host: 192.168.11.39 port: 3671 route_back: true
WARNING (MainThread) [xknx.log] No interface on same subnet as gateway found. Falling back to default gateway.
Imho the warning is ok. Since Docker NATs you, it can’t find a route to 192.x. So it binds to the interface marked as default gateway - which should be tho route to the dockers host.
Try running eg. Wireshark on the Windows host to see if some knx packets even leave the docker environment (maybe they are blocked by a firewall on the host or something later on their way to the knx interface).
I’ve tested non-net-host Docker with route_back on Linux and macOS, both worked fine back then - but sadly I don’t remember exactly how I’ve had set it up.
My bad, your solution works! While testing I forgot that ETS5 was working on 2nd screen (the same machine, so probably UDP packet ended up who knows where, or my KNX-IP interface cannot handle multiple connections).
So, Home Assistant with KNX on Docker Desktop for Windows is possible, without host networking, but with port mapping.
Regarding @mwav3 advice – you are probably right, but for now, I am only experimenting. I haven’t decided on my final home server environment - to use Windows or some NAS (I currently have old image px6-300d).
Regarding server environment: consider using a dedicated device (like a HomeAssistant Blue) or something capable of running Supervised or OS. I’m running containered myself and it feels like I’m kind of missing out on Addons (eg. vscode) - but at this point I’m not going to switch anymore and I’m too lazy to dive into how to install these manually.
This should throw an error / warning in the logs. E_NO_MORE_CONNECTIONS I think, but its not like all KNX/IP interfaces are respecting the protocol perfectly
Additional note. Windows virtualization is reserving ports. That might clash with Home Assistant if you require some port to work through Docker Deskop.
In my case with KNX integration this solved the problem:
net stop winnat
netsh int ipv4 add excludedportrange protocol=tcp startport=8123 numberofports=1
net start winnat
Not that I have any clue about Windows and the commands you listed, but the protocol KNX uses is always UDP, not TCP.
Maybe just reserve protocol-agnostic?
Yes @farmio you are right. I wasn’t sure, so I reserved both, but I made an error when copying code to the forum. I understand that KNX used UDP port is 3671, but HA is using TCP 8123 for web access.
net stop winnat
netsh int ipv4 add excludedportrange protocol=tcp startport=8123 numberofports=1
netsh int ipv4 add excludedportrange protocol=udp startport=3671 numberofports=1
net start winnat
BTW, that also helped with my Ubiquiti UniFi controller. that occasionally had a similar “port used” problem.