Skip to content

Conversation

@LEOBOESE
Copy link

@LEOBOESE LEOBOESE commented Nov 9, 2025

The constant MEDIA_TYPE_MUSIC (and possibly others in the same group) has been removed in recent Home Assistant versions. The HASS.Agent integration’s media_player.py file was still trying to import it from homeassistant.components.media_player.const, which caused an import error (ImportError: cannot import name 'MEDIA_TYPE_MUSIC').

What was done:
Updated the imports and references to use the new enums introduced by Home Assistant. The code now imports from homeassistant.components.media_player import MediaType and uses MediaType.MUSIC instead of the deprecated MEDIA_TYPE_MUSIC constant.

Result:
The integration now loads the media_player platform correctly again, restoring compatibility with the latest versions of Home Assistant.

The constant MEDIA_TYPE_MUSIC (and possibly others in the same group) has been removed in recent Home Assistant versions. The HASS.Agent integration’s media_player.py file was still trying to import it from homeassistant.components.media_player.const, which caused an import error (ImportError: cannot import name 'MEDIA_TYPE_MUSIC').

What was done:
Updated the imports and references to use the new enums introduced by Home Assistant.
The code now imports from homeassistant.components.media_player import MediaType and uses MediaType.MUSIC instead of the deprecated MEDIA_TYPE_MUSIC constant.

Result:
The integration now loads the media_player platform correctly again, restoring compatibility with the latest versions of Home Assistant.
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

Successfully merging this pull request may close these issues.

1 participant