Error message shelly core integration


I´m running Home Assistant OS 5.12: core-2021.3.4 on a windows VM server.

I have about 30 shelly devices and they are configured through ha shelly core integration.
Mostly everything works but sometimes when I´m turning on or off one of my shelly 2.5 it doesnt respond and gives me an error in the log. If I try to turn on/off a second time it works.
What does the error message mean?

2021-03-18 20:47:22 ERROR (MainThread) [homeassistant.core] Error executing service: <ServiceCall light.turn_on (c:ce747467df9b0b1967f8f460dfbc772d): entity_id=['light.simsen'], params=>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/", line 1504, in catch_exceptions
    await coro_or_task
  File "/usr/src/homeassistant/homeassistant/", line 1523, in _execute_service
  File "/usr/src/homeassistant/homeassistant/helpers/", line 204, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/", line 642, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/", line 681, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/", line 679, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/light/", line 235, in async_handle_light_on_service
    await light.async_turn_on(**params)
  File "/usr/src/homeassistant/homeassistant/components/shelly/", line 184, in async_turn_on
    self.control_result = await self.block.set_state(turn="on")
  File "/usr/local/lib/python3.8/site-packages/aioshelly/", line 452, in set_state
    return await self.device.http_request(
  File "/usr/local/lib/python3.8/site-packages/aioshelly/", line 316, in http_request
    resp = await self.aiohttp_session.request(
  File "/usr/local/lib/python3.8/site-packages/aiohttp/", line 544, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/", line 890, in start
    message, payload = await  # type: ignore
  File "/usr/local/lib/python3.8/site-packages/aiohttp/", line 604, in read
    await self._waiter
aiohttp.client_exceptions.ClientOSError: [Errno 104] Connection reset by peer


Your Shellys are dropping the connection for some reason.

Could be a network issue. What is your wifi hardware setup?

30 clients is pushing the limits of consumer grade all in one wifi/router boxes.

Hi, thanks for reply.

I´m using ubiquiti unifi products.,

Dreammachine pro, USG48 ports switch, 4 AC-Pro ap:s.
Current clients at that ap is 12.

I only have problem with one shelly so maybe its somthing wrong with that device.


Yeah ok, that’s not your problem.

But I think you are right that it is a connection issue.
I noticed now that the device is connected to another ap thats far away and have bad signal.

I´ve updated my shelly devices to the latest firmware and activated ap roaming setting.
The device has 73dB and I´ve set the ap roaming setting to 70dB.
But it doesnt connect to the strongest ap.
After a reboot of the device it´s now connected to the strongest ap with 53dB.

Strange…Ap roaming feature doesnt seems to work

Yeah I found the same issue, it’s kind of rubbish. I ended up giving each AP a unique network (ssid) and hard coded the devices to use the closest one.

Good idea.

It would be great if ha retried the command after it reconnected to the device again.
It works the second time I try to turn on or off.

I mean, ha knows that the command hasn´t been executed and reconnects. Then it should resend the command automatically.