HASS on docker for Windows; tradfri/discovery problem

After running HASS.io on my raspberry pi 1 for a long time I wanted to switch to something faster and try it out on Windows 10 pro using docker. (with linux containers).
The problem I’m having is that I cannot connect to my tradfri hub or use the discovery feature (which I think has the same root problem). The frontend is reachable through the normal port and it’s also connecting to the internet and my local mqtt server fine.

What I’m running:

  • Docker CE 18.03.1-ce
  • Windows 10 pro 18.03
  • Latest docker build for HA (homeassistant/home-assistant)

My docker-compose file:

version: ‘3’
container_name: home-assistant
image: homeassistant/home-assistant
restart: unless-stopped

  • “8123:8123”
  • C:\Server\Docker\homeassistant-data\config:/config
  • TZ=Europe/Amsterdam

Home assistant is giving the following error after trying to input my tradfri security code (confuscated the security code):

Error executing service <ServiceCall configurator.configure: configure_id=139911310594624-1, fields=security_code=xxxxxxxxxxxx>

Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/pytradfri/api/aiocoap_api.py”, line 92, in _get_response
r = yield from pr.response
File “/usr/local/lib/python3.6/site-packages/aiocoap/protocol.py”, line 816, in _run_outer
yield from cls._run(app_request, response, weak_observation, protocol, log, exchange_monitor_factory)
File “/usr/local/lib/python3.6/site-packages/aiocoap/protocol.py”, line 865, in _run
blockresponse = yield from blockrequest.response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/src/app/homeassistant/components/tradfri.py”, line 68, in configuration_callback
key = await api_factory.generate_psk(security_code)
File “/usr/local/lib/python3.6/site-packages/pytradfri/api/aiocoap_api.py”, line 196, in generate_psk
self._psk = yield from self.request(command)
File “/usr/local/lib/python3.6/site-packages/pytradfri/api/aiocoap_api.py”, line 152, in request
result = yield from self._execute(api_commands)
File “/usr/local/lib/python3.6/site-packages/pytradfri/api/aiocoap_api.py”, line 142, in _execute
_, res = yield from self._get_response(msg)
File “/usr/local/lib/python3.6/site-packages/pytradfri/api/aiocoap_api.py”, line 98, in _get_response
raise RequestTimeout(‘Request timed out.’, e)
pytradfri.error.RequestTimeout: (‘Request timed out.’, RequestTimedOut())

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/src/app/homeassistant/core.py”, line 1002, in _event_to_service_call
await service_handler.func(service_call)
File “/usr/src/app/homeassistant/components/configurator.py”, line 224, in async_handle_service_call
call.data.get(ATTR_FIELDS, {}))
File “/usr/src/app/homeassistant/components/tradfri.py”, line 71, in configuration_callback
“Security Code not accepted.”)
TypeError: async_notify_errors() takes 3 positional arguments but 4 were given

What I tried to solve this problem:

  • Followed the guide from the website for docker install (https://www.home-assistant.io/docs/installation/docker/
  • Windows firewall is configured properly for docker; even tried disabling it alltogether but doesn’t solve the problem
  • The “–net=host” is for linux and doesn’t work on windows; using port forwarding as an alternative
  • Imported the tradfri config file from my raspberry but does not let me connect
  • Tried different versions of home-assistant docker builds to see if it’s related to 0.69.1; didn’t work
  • I have set tradfri up using the configuration file; which worked on my raspberry pi. Alternatively tried to use the discovery feature but that didn’t work as well

I think it’s similar to these problems on the forum

What I think is happening is that my docker container of home assistant is not connecting to my home network as it should be for using things like the discovery feature or the tradfri bridge. Normally the “–net=host” solves this on linux but only port 8123 is forwarded on windows/docker. Anyone else had a similar issue and solved this problem? Thanks in advance for having a look at this.