1
mirror of https://github.com/home-assistant/core synced 2024-09-15 17:29:45 +02:00

Google Cast: Use own media player app (#55524)

This commit is contained in:
Bram Kragten 2021-11-10 19:40:49 +01:00 committed by GitHub
parent 20f0a6730b
commit 47b6755177
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 7 deletions

View File

@ -46,6 +46,7 @@ from homeassistant.components.media_player.const import (
from homeassistant.components.plex.const import PLEX_URI_SCHEME from homeassistant.components.plex.const import PLEX_URI_SCHEME
from homeassistant.components.plex.services import lookup_plex_media from homeassistant.components.plex.services import lookup_plex_media
from homeassistant.const import ( from homeassistant.const import (
CAST_APP_ID_HOMEASSISTANT_MEDIA,
EVENT_HOMEASSISTANT_STOP, EVENT_HOMEASSISTANT_STOP,
STATE_IDLE, STATE_IDLE,
STATE_OFF, STATE_OFF,
@ -244,6 +245,7 @@ class CastDevice(MediaPlayerEntity):
), ),
ChromeCastZeroconf.get_zeroconf(), ChromeCastZeroconf.get_zeroconf(),
) )
chromecast.media_controller.app_id = CAST_APP_ID_HOMEASSISTANT_MEDIA
self._chromecast = chromecast self._chromecast = chromecast
if CAST_MULTIZONE_MANAGER_KEY not in self.hass.data: if CAST_MULTIZONE_MANAGER_KEY not in self.hass.data:
@ -816,6 +818,7 @@ class DynamicCastGroup:
), ),
ChromeCastZeroconf.get_zeroconf(), ChromeCastZeroconf.get_zeroconf(),
) )
chromecast.media_controller.app_id = CAST_APP_ID_HOMEASSISTANT_MEDIA
self._chromecast = chromecast self._chromecast = chromecast
if CAST_MULTIZONE_MANAGER_KEY not in self.hass.data: if CAST_MULTIZONE_MANAGER_KEY not in self.hass.data:

View File

@ -35,7 +35,7 @@ from homeassistant.const import (
ATTR_MODE, ATTR_MODE,
ATTR_SUPPORTED_FEATURES, ATTR_SUPPORTED_FEATURES,
ATTR_TEMPERATURE, ATTR_TEMPERATURE,
CAST_APP_ID_HOMEASSISTANT, CAST_APP_ID_HOMEASSISTANT_MEDIA,
SERVICE_ALARM_ARM_AWAY, SERVICE_ALARM_ARM_AWAY,
SERVICE_ALARM_ARM_CUSTOM_BYPASS, SERVICE_ALARM_ARM_CUSTOM_BYPASS,
SERVICE_ALARM_ARM_HOME, SERVICE_ALARM_ARM_HOME,
@ -307,7 +307,7 @@ class CameraStreamTrait(_Trait):
) )
self.stream_info = { self.stream_info = {
"cameraStreamAccessUrl": f"{get_url(self.hass)}{url}", "cameraStreamAccessUrl": f"{get_url(self.hass)}{url}",
"cameraStreamReceiverAppId": CAST_APP_ID_HOMEASSISTANT, "cameraStreamReceiverAppId": CAST_APP_ID_HOMEASSISTANT_MEDIA,
} }

View File

@ -695,9 +695,6 @@ PRECISION_TENTHS: Final = 0.1
# cloud, alexa, or google_home components # cloud, alexa, or google_home components
CLOUD_NEVER_EXPOSED_ENTITIES: Final[list[str]] = ["group.all_locks"] CLOUD_NEVER_EXPOSED_ENTITIES: Final[list[str]] = ["group.all_locks"]
# The ID of the Home Assistant Cast App
CAST_APP_ID_HOMEASSISTANT: Final = "B12CE3CA"
ENTITY_CATEGORY_CONFIG: Final = "config" ENTITY_CATEGORY_CONFIG: Final = "config"
ENTITY_CATEGORY_DIAGNOSTIC: Final = "diagnostic" ENTITY_CATEGORY_DIAGNOSTIC: Final = "diagnostic"
ENTITY_CATEGORY_SYSTEM: Final = "system" ENTITY_CATEGORY_SYSTEM: Final = "system"
@ -710,3 +707,8 @@ ENTITY_CATEGORIES: Final[list[str]] = [
ENTITY_CATEGORY_DIAGNOSTIC, ENTITY_CATEGORY_DIAGNOSTIC,
ENTITY_CATEGORY_SYSTEM, ENTITY_CATEGORY_SYSTEM,
] ]
# The ID of the Home Assistant Media Player Cast App
CAST_APP_ID_HOMEASSISTANT_MEDIA: Final = "B45F4572"
# The ID of the Home Assistant Lovelace Cast App
CAST_APP_ID_HOMEASSISTANT_LOVELACE: Final = "A078F6B0"

View File

@ -940,7 +940,7 @@ async def test_trait_execute_adding_query_data(hass):
"states": { "states": {
"online": True, "online": True,
"cameraStreamAccessUrl": "https://example.com/api/streams/bla", "cameraStreamAccessUrl": "https://example.com/api/streams/bla",
"cameraStreamReceiverAppId": "B12CE3CA", "cameraStreamReceiverAppId": "B45F4572",
}, },
} }
] ]

View File

@ -146,7 +146,7 @@ async def test_camera_stream(hass):
assert trt.query_attributes() == { assert trt.query_attributes() == {
"cameraStreamAccessUrl": "https://example.com/api/streams/bla", "cameraStreamAccessUrl": "https://example.com/api/streams/bla",
"cameraStreamReceiverAppId": "B12CE3CA", "cameraStreamReceiverAppId": "B45F4572",
} }