Skip to content

Client disconnecting #159

Description

@MEntOMANdo

Strange issue here. Using latest python library release, connecting to Music Assistant with a long-life token.

Connects, works fine. I can issue any command and get an appropriate response, such as querying players, making adjustments, playing audio, etc. Seemingly no issues.

But, the client gets disconnected at ~55 seconds from connection.

repr(m._client) shows MusicAssistantClient(connection=WebsocketsConnection, not connected)
Nothing in the MA logs about a disconnection, timeout, failure to receive keep-alive, etc.

Further, once disconnected, there's nothing I can do to reconnect. Issuing connect() throws an exception.

await m._client.connect()
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/music_assistant_client/client.py", line 230, in connect
    result = await self.connection.connect()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/music_assistant_client/connection.py", line 76, in connect
    raise InvalidState(msg)

music_assistant_client.exceptions.InvalidState: Already connected

So it thinks it's both connected and not-connected at the same time. Meanwhile, HASS has no trouble staying connected to MA, and I can issue commands through HASS API, summoning MA actions, without problems. (And I would just do that, except there's only a subset of features exposed via HASS service actions.)

Am I missing some logic to keep the connection alive?

Activity

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions