core: Shelly integration broken in core-2021.2.0
The problem
Shelly integration is broken since core-2021.2.0 update. Entities are unavailable. When delete shelly device, a new integration is detected but unable to configure (endless spining).
What is version of Home Assistant Core has the issue?
core-2021.2.0
What was the last working version of Home Assistant Core?
core-2021.1.5
What type of installation are you running?
Home Assistant Supervised
Integration causing the issue
Shelly
Link to integration documentation on our website
https://www.home-assistant.io/integrations/shelly/
Example YAML snippet
# Put your YAML below this line
Anything in the logs that might be useful for us?
# Put your logs below this line
Logger: homeassistant.components.shelly.config_flow
Source: components/shelly/__init__.py:54
Integration: Shelly (documentation, issues)
First occurred: 8:45:55 AM (1 occurrences)
Last logged: 8:45:55 AM
Unexpected exception
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/shelly/config_flow.py", line 166, in async_step_confirm_discovery
device_info = await validate_input(self.hass, self.host, {})
File "/usr/src/homeassistant/homeassistant/components/shelly/config_flow.py", line 41, in validate_input
coap_context = await get_coap_context(hass)
File "/usr/src/homeassistant/homeassistant/helpers/singleton.py", line 42, in async_wrapped
result = await func(hass)
File "/usr/src/homeassistant/homeassistant/components/shelly/__init__.py", line 54, in get_coap_context
await context.initialize()
File "/usr/local/lib/python3.8/site-packages/aioshelly/coap.py", line 86, in initialize
self.sock = socket_init()
File "/usr/local/lib/python3.8/site-packages/aioshelly/coap.py", line 66, in socket_init
sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, group)
OSError: [Errno 105] No buffer space available
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 7
- Comments: 36 (15 by maintainers)
Commits related to this issue
- Increase maximum IGMP memberships Currently Linux has a limit of IGMP memberships of 20. When trying to add membership to more than that, Linux fails with: OSError: [Errno 105] No buffer space availa... — committed to agners/operating-system by agners 3 years ago
- Increase maximum IGMP memberships (#1222) Currently Linux has a limit of IGMP memberships of 20. When trying to add membership to more than that, Linux fails with: OSError: [Errno 105] No buffer sp... — committed to home-assistant/operating-system by agners 3 years ago
- Increase maximum IGMP memberships (#1222) Currently Linux has a limit of IGMP memberships of 20. When trying to add membership to more than that, Linux fails with: OSError: [Errno 105] No buffer sp... — committed to jethome-ru/homeassistant-operating-system by agners 3 years ago
Hi there,
I updated to 2021.2.0 and had the problem too with my Shelly EM integration.
After some digging regarding the error, I found out that it is related to multicast addresses/groups. I followed part of the instructions here : https://blog.mphomphego.co.za/blog/2017/06/28/why-am-i-getting-errno105-no-buffer-space-available-when-subscribing-to-multicast-addresses.html#:~:text=The "Errno 105" in this,groups at the same time.
by only adding the line below in the /etc/sysctl.conf :
Increase number of multicast groups permitted
net.ipv4.igmp_max_memberships=1024
After rebooting HASS, the Shelly integration worked again.
I am running it on an Odroid N2+, with Armbian.
Great. Going to close this. We have reverted the change to listen on all interfaces.
Ban by default attaching sockets to all network interfaces
Set the igmp_max_memberships carefully. The default value is 20 increasing it significantly can have negative impact on the system. I would first try with 256 and if that works leave it like that. No need to have the potential to waste kernel memory.
I had the same problem, but turned out there was another layer to it. In my logs I saw
and from looking at the code in aioshelly/coap.py and the recent changes I was able to deduce it was tripping over a secondary IP on the same interface. This is how my main interface is normally configured:
Disabling the secondary IP and restarting homeassistant made all shellies work immediately.
@benniju you also seem to have two networks on eth0, not quite the same as my setup but similar. The code tries to join eth0 into the multicast group twice, and the second time fails.