Set Google Cast audio devices as speakers (#73832)

This commit is contained in:
Felipe Santos 2022-06-28 18:26:25 -03:00 committed by GitHub
parent ef5fccad9e
commit 4aa8570107
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,6 +30,7 @@ from homeassistant.components import media_source, zeroconf
from homeassistant.components.media_player import (
BrowseError,
BrowseMedia,
MediaPlayerDeviceClass,
MediaPlayerEntity,
MediaPlayerEntityFeature,
async_process_play_media_url,
@ -300,6 +301,12 @@ class CastMediaPlayerEntity(CastDevice, MediaPlayerEntity):
name=str(cast_info.friendly_name),
)
if cast_info.cast_info.cast_type in [
pychromecast.const.CAST_TYPE_AUDIO,
pychromecast.const.CAST_TYPE_GROUP,
]:
self._attr_device_class = MediaPlayerDeviceClass.SPEAKER
async def async_added_to_hass(self):
"""Create chromecast object when added to hass."""
self._async_setup(self.entity_id)