Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated entities (i.e. SUPPORT_BROWSE_MEDIA) have been removed from HA 2024.1, leading to an exception #58

Open
theomega opened this issue Jan 6, 2024 · 0 comments

Comments

@theomega
Copy link

theomega commented Jan 6, 2024

When browsing media on a teufel_raumfeld device in HA 2024.1, you get the following error:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 1298, in websocket_browse_media
    if MediaPlayerEntityFeature.BROWSE_MEDIA not in player.supported_features:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'int' is not iterable

Reason is that the teufel_raumfeld implementation still returns the old int-based constants for the supported_features method here.

According to the docs, these int contents have been removed in 2024.1, so this is why this error occurs. We are forced to use the MediaPlayerEntityFeature enum according to the docs.

I think what needs to be done is in the media_player.py of this repo here, we need to replace

SUPPORT_RAUMFELD_GROUP = (
    SUPPORT_PAUSE
    | SUPPORT_SEEK
    | SUPPORT_VOLUME_SET
    | SUPPORT_VOLUME_MUTE
    | SUPPORT_PREVIOUS_TRACK
    | SUPPORT_NEXT_TRACK
    | SUPPORT_PLAY_MEDIA
    | SUPPORT_VOLUME_STEP
    | SUPPORT_STOP
    | SUPPORT_TURN_ON
    | SUPPORT_TURN_OFF
    | SUPPORT_PLAY
    | SUPPORT_SHUFFLE_SET
    | SUPPORT_BROWSE_MEDIA
    | SUPPORT_REPEAT_SET
)

with something like

SUPPORT_RAUMFELD_GROUP = (
    MediaPlayerEntityFeature.SUPPORT_PAUSE
    | MediaPlayerEntityFeature.SUPPORT_SEEK
    | MediaPlayerEntityFeature.SUPPORT_VOLUME_SET
    | MediaPlayerEntityFeature.SUPPORT_VOLUME_MUTE
    | MediaPlayerEntityFeature.SUPPORT_PREVIOUS_TRACK
    | MediaPlayerEntityFeature.SUPPORT_NEXT_TRACK
    | MediaPlayerEntityFeature.SUPPORT_PLAY_MEDIA
    | MediaPlayerEntityFeature.SUPPORT_VOLUME_STEP
    | MediaPlayerEntityFeature.SUPPORT_STOP
    | MediaPlayerEntityFeature.SUPPORT_TURN_ON
    | MediaPlayerEntityFeature.SUPPORT_TURN_OFF
    | MediaPlayerEntityFeature.SUPPORT_PLAY
    | MediaPlayerEntityFeature.SUPPORT_SHUFFLE_SET
    | MediaPlayerEntityFeature.SUPPORT_BROWSE_MEDIA
    | MediaPlayerEntityFeature.SUPPORT_REPEAT_SET
)

Similar issues might come up from other constants as all of these integer based constants seem to have been retired.

@theomega theomega changed the title Deprecated entities (i.e. SUPPORT_BROWSE_MEDIA) have been removed from HA 2025.1, leading to an exception Deprecated entities (i.e. SUPPORT_BROWSE_MEDIA) have been removed from HA 2024.1, leading to an exception Jan 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant