Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multicast socket error on WSL system #171

Open
dshokouhi opened this issue Jun 25, 2020 · 2 comments
Open

Multicast socket error on WSL system #171

dshokouhi opened this issue Jun 25, 2020 · 2 comments

Comments

@dshokouhi
Copy link

Home Assistant release with the issue (if applicable):

i was testing 0.112b0 on my WSL dev environment
Last working Home Assistant release (if known):
none

PyXiaomiGateway library version (if known):
0.12.4

Operating environment (Hass.io/Docker/Windows/etc.):
windows subsystem for linux

Traceback (if applicable):

2020-06-25 07:52:15 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Xiaomi Aqara Gateway for xiaomi_aqara
Traceback (most recent call last):
  File "/mnt/c/dev/home-assistant/homeassistant/config_entries.py", line 220, in async_setup
    hass, self
  File "/mnt/c/dev/home-assistant/homeassistant/components/xiaomi_aqara/__init__.py", line 161, in async_setup_entry
    await hass.async_add_executor_job(gateway_discovery.listen)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/mnt/c/dev/home-assistant/venv/lib/python3.7/site-packages/xiaomi_gateway/__init__.py", line 146, in listen
    self._mcastsocket = self._create_mcast_socket()
  File "/mnt/c/dev/home-assistant/venv/lib/python3.7/site-packages/xiaomi_gateway/__init__.py", line 127, in _create_mcast_socket
    sock.bind((self.MULTICAST_ADDRESS, self.MULTICAST_PORT))
OSError: [Errno 99] Cannot assign requested address

Description of the bug:

This is an odd issue that I was able to resolve on my own. I noticed that the code looks for the windows platform and it seems in this case it is not identifying it properly. If I modify line 127 to be identical to line 136 the error disappears and I am able to use the integration successfully.

sock.bind(('', self.MULTICAST_PORT))

More details can be found in this closed HA bug: home-assistant/core#37073

I have tried the above with network interface set to any and also the IP address of the HA installation but the error still persists.

@starkillerOG
Copy link
Contributor

@Danielhiversen could you look at this, since a lot of users are experiancing problems with this in HomeAssistant in the latest release.

Maybe just put a try except block around it and on the OSError just use sock.bind(('', self.MULTICAST_PORT))

@starkillerOG
Copy link
Contributor

This can be closed, since the PR to fix this issue is merged.
It will be in the upcomming release of HomeAssistant 0.113.4 that will be released on August 12 2020 (I think)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants