Set Google Cast audio devices as speakers (#73832)
This commit is contained in:
parent
ef5fccad9e
commit
4aa8570107
1 changed files with 7 additions and 0 deletions
|
@ -30,6 +30,7 @@ from homeassistant.components import media_source, zeroconf
|
||||||
from homeassistant.components.media_player import (
|
from homeassistant.components.media_player import (
|
||||||
BrowseError,
|
BrowseError,
|
||||||
BrowseMedia,
|
BrowseMedia,
|
||||||
|
MediaPlayerDeviceClass,
|
||||||
MediaPlayerEntity,
|
MediaPlayerEntity,
|
||||||
MediaPlayerEntityFeature,
|
MediaPlayerEntityFeature,
|
||||||
async_process_play_media_url,
|
async_process_play_media_url,
|
||||||
|
@ -300,6 +301,12 @@ class CastMediaPlayerEntity(CastDevice, MediaPlayerEntity):
|
||||||
name=str(cast_info.friendly_name),
|
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):
|
async def async_added_to_hass(self):
|
||||||
"""Create chromecast object when added to hass."""
|
"""Create chromecast object when added to hass."""
|
||||||
self._async_setup(self.entity_id)
|
self._async_setup(self.entity_id)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue