core icon indicating copy to clipboard operation
core copied to clipboard

Smartthings - Error occurred while subscribing to events (2025.4)

Open holdestmade opened this issue 8 months ago • 13 comments

The problem

Still getting some errors in the HA log related to the Smartthings integration with HA v2025.4.1

What version of Home Assistant Core has the issue?

2025.4.1

What was the last working version of Home Assistant Core?

NA

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Smartthings

Link to integration documentation on our website

https://www.home-assistant.io/integrations/smartthings/

Diagnostics information

No response

Example YAML snippet


Anything in the logs that might be useful for us?

Logger: pysmartthings
Source: /usr/local/lib/python3.13/site-packages/pysmartthings/smartthings.py:505
First occurred: 11:50:52 am (24 occurrences)
Last logged: 12:25:31 pm

Connection error occurred while subscribing to events
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/aiohttp/client_proto.py", line 93, in connection_lost
    uncompleted = self._parser.feed_eof()
  File "aiohttp/_http_parser.pyx", line 508, in aiohttp._http_parser.HttpParser.feed_eof
aiohttp.http_exceptions.TransferEncodingError: 400, message:
  Not enough data for satisfy transfer length header.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/pysmartthings/smartthings.py", line 494, in subscribe
    await self._internal_subscribe(session, subscription_url)
  File "/usr/local/lib/python3.13/site-packages/pysmartthings/smartthings.py", line 416, in _internal_subscribe
    async for event in event_source:
    ...<39 lines>...
                break
  File "/usr/local/lib/python3.13/site-packages/aiohttp_sse_client2/client.py", line 157, in __anext__
    async for line_in_bytes in self._response.content:
    ...<21 lines>...
            self._process_field(line, '')
  File "/usr/local/lib/python3.13/site-packages/aiohttp/streams.py", line 52, in __anext__
    rv = await self.read_func()
         ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/streams.py", line 352, in readline
    return await self.readuntil()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/streams.py", line 386, in readuntil
    await self._wait("readuntil")
  File "/usr/local/lib/python3.13/site-packages/aiohttp/streams.py", line 347, in _wait
    await waiter
aiohttp.client_exceptions.ClientPayloadError: Response payload is not completed: <TransferEncodingError: 400, message='Not enough data for satisfy transfer length header.'>

Additional information

Closed issues with same problem:

#142037 #141717

holdestmade avatar Apr 10 '25 11:04 holdestmade

Hey there @joostlek, mind taking a look at this issue as it has been labeled with an integration (smartthings) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of smartthings can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign smartthings Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


smartthings documentation smartthings source (message by IssueLinks)

home-assistant[bot] avatar Apr 10 '25 11:04 home-assistant[bot]

I have this problem me too

2025-04-11 13:53:41.760 ERROR (MainThread) [pysmartthings] Connection error occurred while subscribing to events
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/pysmartthings/smartthings.py", line 494, in subscribe
    await self._internal_subscribe(session, subscription_url)
  File "/usr/local/lib/python3.13/site-packages/pysmartthings/smartthings.py", line 416, in _internal_subscribe
    async for event in event_source:
    ...<39 lines>...
                break
  File "/usr/local/lib/python3.13/site-packages/aiohttp_sse_client2/client.py", line 157, in __anext__
    async for line_in_bytes in self._response.content:
    ...<21 lines>...
            self._process_field(line, '')
  File "/usr/local/lib/python3.13/site-packages/aiohttp/streams.py", line 52, in __anext__
    rv = await self.read_func()
         ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/streams.py", line 352, in readline
    return await self.readuntil()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/streams.py", line 386, in readuntil
    await self._wait("readuntil")
  File "/usr/local/lib/python3.13/site-packages/aiohttp/streams.py", line 347, in _wait
    await waiter
aiohttp.client_exceptions.SocketTimeoutError: Timeout on reading data from socket

My HA is a docker installation with HOME ASSISTANT last version (2025.4).

samuelecarpene avatar Apr 11 '25 22:04 samuelecarpene

That's a differnet issue

joostlek avatar Apr 11 '25 22:04 joostlek

@joostlek As soon as I have time I'll open a new ticket

samuelecarpene avatar Apr 11 '25 23:04 samuelecarpene

But your issue seems to be that it just had a time out, unless it didnt recover it should be fine

joostlek avatar Apr 11 '25 23:04 joostlek

Same issue on my side:

Logger: pysmartthings
Source: /usr/local/lib/python3.13/site-packages/pysmartthings/smartthings.py:505
First occurred: 02:12:47 (3 occurrences)
Last logged: 04:57:41

Connection error occurred while subscribing to events
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/aiohttp/client_proto.py", line 93, in connection_lost
    uncompleted = self._parser.feed_eof()
  File "aiohttp/_http_parser.pyx", line 508, in aiohttp._http_parser.HttpParser.feed_eof
aiohttp.http_exceptions.TransferEncodingError: 400, message:
  Not enough data for satisfy transfer length header.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/pysmartthings/smartthings.py", line 494, in subscribe
    await self._internal_subscribe(session, subscription_url)
  File "/usr/local/lib/python3.13/site-packages/pysmartthings/smartthings.py", line 416, in _internal_subscribe
    async for event in event_source:
    ...<39 lines>...
                break
  File "/usr/local/lib/python3.13/site-packages/aiohttp_sse_client2/client.py", line 157, in __anext__
    async for line_in_bytes in self._response.content:
    ...<21 lines>...
            self._process_field(line, '')
  File "/usr/local/lib/python3.13/site-packages/aiohttp/streams.py", line 52, in __anext__
    rv = await self.read_func()
         ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/streams.py", line 352, in readline
    return await self.readuntil()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/streams.py", line 386, in readuntil
    await self._wait("readuntil")
  File "/usr/local/lib/python3.13/site-packages/aiohttp/streams.py", line 347, in _wait
    await waiter
aiohttp.client_exceptions.ClientPayloadError: Response payload is not completed: <TransferEncodingError: 400, message='Not enough data for satisfy transfer length header.'>

MikeBP13 avatar Apr 12 '25 06:04 MikeBP13

But to double check, do you experience any issues with the integration other than that?

joostlek avatar Apr 12 '25 11:04 joostlek

During the time frame the last 3 errors occurred, I was not actively using the integration - I was asleep. So I cannot tell if something obvious went wrong. I have only one device in Smartthings - a washing machine.

MikeBP13 avatar Apr 12 '25 12:04 MikeBP13

No no other issues, apart from the volume is wrong but it has always been wrong.

holdestmade avatar Apr 13 '25 10:04 holdestmade

I'm also getting the same as @samuelecarpene now

holdestmade avatar Apr 13 '25 11:04 holdestmade

Hi everybody, Same problem for me too

2025-04-24 05:30:54.716 ERROR (MainThread) [pysmartthings] Connection error occurred while subscribing to events Traceback (most recent call last): File "/usr/local/lib/python3.13/site-packages/aiohttp/client_proto.py", line 93, in connection_lost uncompleted = self._parser.feed_eof() File "aiohttp/_http_parser.pyx", line 508, in aiohttp._http_parser.HttpParser.feed_eof aiohttp.http_exceptions.TransferEncodingError: 400, message: Not enough data for satisfy transfer length header.

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/local/lib/python3.13/site-packages/pysmartthings/smartthings.py", line 494, in subscribe await self._internal_subscribe(session, subscription_url) File "/usr/local/lib/python3.13/site-packages/pysmartthings/smartthings.py", line 416, in _internal_subscribe async for event in event_source: ...<39 lines>... break File "/usr/local/lib/python3.13/site-packages/aiohttp_sse_client2/client.py", line 157, in anext async for line_in_bytes in self._response.content: ...<21 lines>... self._process_field(line, '') File "/usr/local/lib/python3.13/site-packages/aiohttp/streams.py", line 52, in anext rv = await self.read_func() ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/aiohttp/streams.py", line 352, in readline return await self.readuntil() ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/aiohttp/streams.py", line 386, in readuntil await self._wait("readuntil") File "/usr/local/lib/python3.13/site-packages/aiohttp/streams.py", line 347, in _wait await waiter aiohttp.client_exceptions.ClientPayloadError: Response payload is not completed: <TransferEncodingError: 400, message='Not enough data for satisfy transfer length header.'>

The error occurred multiple times 2025-04-23 01:27:47.661 ERROR (MainThread) [pysmartthings] Connection error occurred while subscribing to events 2025-04-23 01:55:54.387 ERROR (MainThread) [pysmartthings] Connection error occurred while subscribing to events 2025-04-23 03:42:50.867 ERROR (MainThread) [pysmartthings] Connection error occurred while subscribing to events 2025-04-23 04:17:55.708 ERROR (MainThread) [pysmartthings] Connection error occurred while subscribing to events 2025-04-23 04:31:52.964 ERROR (MainThread) [pysmartthings] Connection error occurred while subscribing to events ......

Sometimes this error alternates with this other type of error

2025-04-24 03:43:13.549 ERROR (MainThread) [pysmartthings] Connection error occurred while subscribing to events Traceback (most recent call last): File "/usr/local/lib/python3.13/site-packages/pysmartthings/smartthings.py", line 494, in subscribe await self._internal_subscribe(session, subscription_url) File "/usr/local/lib/python3.13/site-packages/pysmartthings/smartthings.py", line 416, in _internal_subscribe async for event in event_source: ...<39 lines>... break File "/usr/local/lib/python3.13/site-packages/aiohttp_sse_client2/client.py", line 157, in anext async for line_in_bytes in self._response.content: ...<21 lines>... self._process_field(line, '') File "/usr/local/lib/python3.13/site-packages/aiohttp/streams.py", line 52, in anext rv = await self.read_func() ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/aiohttp/streams.py", line 352, in readline return await self.readuntil() ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/aiohttp/streams.py", line 386, in readuntil await self._wait("readuntil") File "/usr/local/lib/python3.13/site-packages/aiohttp/streams.py", line 347, in _wait await waiter aiohttp.client_exceptions.SocketTimeoutError: Timeout on reading data from socket

Thanks

giancn avatar Apr 24 '25 06:04 giancn

A similar problem for me

Logger: pysmartthings Quelle: /usr/local/lib/python3.13/site-packages/pysmartthings/smartthings.py:505 Erstmals aufgetreten: 02:03:06 (2 Vorkommnisse) Zuletzt protokolliert: 04:22:30

Connection error occurred while subscribing to events Traceback (most recent call last): File "/usr/local/lib/python3.13/site-packages/pysmartthings/smartthings.py", line 494, in subscribe await self._internal_subscribe(session, subscription_url) File "/usr/local/lib/python3.13/site-packages/pysmartthings/smartthings.py", line 416, in _internal_subscribe async for event in event_source: ...<39 lines>... break File "/usr/local/lib/python3.13/site-packages/aiohttp_sse_client2/client.py", line 157, in anext async for line_in_bytes in self._response.content: ...<21 lines>... self._process_field(line, '') File "/usr/local/lib/python3.13/site-packages/aiohttp/streams.py", line 52, in anext rv = await self.read_func() ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/aiohttp/streams.py", line 352, in readline return await self.readuntil() ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/aiohttp/streams.py", line 386, in readuntil await self._wait("readuntil") File "/usr/local/lib/python3.13/site-packages/aiohttp/streams.py", line 347, in _wait await waiter aiohttp.client_exceptions.SocketTimeoutError: Timeout on reading data from socket

Bikervossibaer avatar May 04 '25 07:05 Bikervossibaer

Same thing here, but I have a clue. In my case, this coincides with a weekly router reboot at 3 AM and results in the ST integration being left in "Failed to set up" state. Reloading the integration fixes it. This has happened for at least the past 2 weeks at the same time.

Seems like when connectivity is lost for a couple minutes this happens.

yorb avatar May 05 '25 17:05 yorb

@joostlek said this would be fixed with 2025.4.4, but I'm still seeing it.

Logger: pysmartthings
Source: /usr/local/lib/python3.13/site-packages/pysmartthings/smartthings.py:505
First occurred: May 3, 2025 at 10:07:23 PM (4 occurrences)
Last logged: 12:52:55 AM

Connection error occurred while subscribing to events
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/aiohttp/client_proto.py", line 93, in connection_lost
    uncompleted = self._parser.feed_eof()
  File "aiohttp/_http_parser.pyx", line 508, in aiohttp._http_parser.HttpParser.feed_eof
aiohttp.http_exceptions.TransferEncodingError: 400, message:
  Not enough data for satisfy transfer length header.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/pysmartthings/smartthings.py", line 494, in subscribe
    await self._internal_subscribe(session, subscription_url)
  File "/usr/local/lib/python3.13/site-packages/pysmartthings/smartthings.py", line 416, in _internal_subscribe
    async for event in event_source:
    ...<39 lines>...
                break
  File "/usr/local/lib/python3.13/site-packages/aiohttp_sse_client2/client.py", line 157, in __anext__
    async for line_in_bytes in self._response.content:
    ...<21 lines>...
            self._process_field(line, '')
  File "/usr/local/lib/python3.13/site-packages/aiohttp/streams.py", line 52, in __anext__
    rv = await self.read_func()
         ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/streams.py", line 352, in readline
    return await self.readuntil()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/streams.py", line 386, in readuntil
    await self._wait("readuntil")
  File "/usr/local/lib/python3.13/site-packages/aiohttp/streams.py", line 347, in _wait
    await waiter
aiohttp.client_exceptions.ClientPayloadError: Response payload is not completed: <TransferEncodingError: 400, message='Not enough data for satisfy transfer length header.'>

LiquidPT avatar May 06 '25 18:05 LiquidPT

I said what where

joostlek avatar May 06 '25 18:05 joostlek

From a linked similar issue https://github.com/home-assistant/core/issues/142037#issuecomment-2772237923

This will be fixed in 2025.4

LiquidPT avatar May 06 '25 18:05 LiquidPT

Oh then I was incorrect lol, this isn't fixed, but I believe this error doesn't block the working of the integration

joostlek avatar May 06 '25 18:05 joostlek

“yorb” seems to be on the right track.

With my DSL connection (Germany), a forced disconnection from the ISP is carried out every 24 hours. This is exactly when the error occurs for the first time.

Funnily enough, it then occurs a second time when Alexa wakes me up. No joke, the SmartThings error occurs again at the set wake-up time of the Echo Dot.

I would assume that it is related to the SmartThings skill for Alexa.

But maybe I should get myself an aluminum hat (lol).

Bikervossibaer avatar May 07 '25 16:05 Bikervossibaer

Lolwhat. Sounds interesting. Yea I am wondering if the integration just works normally for the rest, as the connection is lost, but it should just recover. As long that is happening I am happy, then I just need to tweak the logging

joostlek avatar May 07 '25 16:05 joostlek

Does it perhaps make sense for me to take the time to set up everything from Smart Things again?

So, delete integration completely, delete devices and entity remnants in Home Assistant if necessary. Delete Home Assistant rights in the Samsung account.

Then set up from scratch.

Bikervossibaer avatar May 07 '25 17:05 Bikervossibaer

I don't think that matters, in theory the integration works now right?

joostlek avatar May 07 '25 17:05 joostlek

I still have a fundamental problem that I want to discuss with Samsung support in the coming week.

The SmartThings app sets my two TVs to offline at irregular intervals. The reason given is that I haven't used the devices for a long time.

Even if I operate the TVs with the app several times a week, they are killed.

Surprisingly, the oven, washing machine and SmartTags always remain online.

HomeAssitant then always refuses to execute the TV commands once the devices have been killed by SmartThings.

Otherwise, the integration is actually running smoothly. So on the whole, good work.

Bikervossibaer avatar May 07 '25 17:05 Bikervossibaer

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Still happening...

MikeBP13 avatar Aug 06 '25 04:08 MikeBP13

Still happening...

Bikervossibaer avatar Aug 07 '25 16:08 Bikervossibaer

Same here. I have to manually refresh the Smart Things integration to restore the functionality because all devices go to Unavailable state:

Image

Aside from the logs other people sent here ("error subscribing to events"), I'm seeing this other error too at the same time the integration goes unavailable ("Error setting up entry [home] for smartthings"):

Image
Registrador: homeassistant.config_entries
Fonte: config_entries.py:761
Ocorreu pela primeira vez: 12 de outubro de 2025 às 05:01:33 (2 ocorrências )
Último registro: 14 de outubro de 2025 às 20:13:11

Error setting up entry Quintas for smartthings
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 761, in __async_setup_with_context
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/smartthings/__init__.py", line 118, in async_setup_entry
    implementation = await async_get_config_entry_implementation(hass, entry)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 581, in async_get_config_entry_implementation
    raise ValueError("Implementation not available")
ValueError: Implementation not available

wagner avatar Oct 15 '25 14:10 wagner

ValueError: Implementation not available

This problem is covered by: https://github.com/home-assistant/core/pull/156203

mik-laj avatar Nov 13 '25 14:11 mik-laj