Skip to content

EOFError: Unexpected end of stream.  #17

Open

Description

@roethigj

Hi,
thank you for the library.

Each time when I switch on my treadmill and try to connect I get the EOFError. I need to start and stop the treadmill, than it connects.

Connection to TREADMILL: name: Domyos-TC-0278, address: D8:2F:1B:52:90:04
Traceback (most recent call last):
  File "/home/johannes/blebridge/blebridge/test.py", line 35, in <module>
    asyncio.run(run())
  File "/usr/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/johannes/blebridge/blebridge/test.py", line 26, in run
    async with get_client(dev, machine_type) as c:
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/johannes/blebridge/blebridge/.venv/lib/python3.12/site-packages/pyftms/client/client.py", line 105, in __aenter__
    await self.connect()
  File "/home/johannes/blebridge/blebridge/.venv/lib/python3.12/site-packages/pyftms/client/client.py", line 159, in connect
    await self._connect()
  File "/home/johannes/blebridge/blebridge/.venv/lib/python3.12/site-packages/pyftms/client/client.py", line 257, in _connect
    await self._controller.subscribe(self._cli)
  File "/home/johannes/blebridge/blebridge/.venv/lib/python3.12/site-packages/pyftms/client/backends/controller.py", line 109, in subscribe
    self._on_training_status(c, await cli.read_gatt_char(c))
  File "/home/johannes/blebridge/blebridge/.venv/lib/python3.12/site-packages/pyftms/client/backends/controller.py", line 255, in _on_training_status
    status = TrainingStatusModel._deserialize(bio)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/johannes/blebridge/blebridge/.venv/lib/python3.12/site-packages/pyftms/serializer/model.py", line 141, in _deserialize
    return cls(**cls._deserialize_asdict(src))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/johannes/blebridge/blebridge/.venv/lib/python3.12/site-packages/pyftms/serializer/model.py", line 123, in _deserialize_asdict
    value, type_ = serializer._deserialize(src), field.type
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/johannes/blebridge/blebridge/.venv/lib/python3.12/site-packages/pyftms/serializer/num.py", line 56, in _deserialize
    raise EOFError("Unexpected end of stream.")
EOFError: Unexpected end of stream.

Activity

  1. basvd commented on Sep 6, 2025

    @basvd

    I ran into a similar issue with the TrainingStatusModel deserialization. In my case it's a rower, but I think the problem is the same. Instead of receiving two bytes of data for the training status, I get only one byte.

    A possible workaround is to simply zero the data instead of raising an error, by changing line 61 in serializer/num.py:

            if len(data := stream.read(self.size)) != self.size:
                data = bytes(self.size)
    

    From what I've read, FTMS is not fully implemented by multiple machines out there, so it might be a good idea to make this library more fault-tolerant.

  2. chkuendig commented on Jan 29, 2026

    @chkuendig

    I had the same issue with my Sole F65, might be worth trying out if #54 also fixes your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions