mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 01:08:12 +00:00
Support TVs in SmartThings (#141366)
This commit is contained in:
parent
42566b7378
commit
83c21570c8
@ -22,7 +22,6 @@ from .entity import SmartThingsEntity
|
||||
|
||||
MEDIA_PLAYER_CAPABILITIES = (
|
||||
Capability.AUDIO_MUTE,
|
||||
Capability.AUDIO_TRACK_DATA,
|
||||
Capability.AUDIO_VOLUME,
|
||||
Capability.MEDIA_PLAYBACK,
|
||||
)
|
||||
@ -241,10 +240,14 @@ class SmartThingsMediaPlayer(SmartThingsEntity, MediaPlayerEntity):
|
||||
def media_title(self) -> str | None:
|
||||
"""Title of current playing media."""
|
||||
if (
|
||||
track_data := self.get_attribute_value(
|
||||
Capability.AUDIO_TRACK_DATA, Attribute.AUDIO_TRACK_DATA
|
||||
not self.supports_capability(Capability.AUDIO_TRACK_DATA)
|
||||
or (
|
||||
track_data := self.get_attribute_value(
|
||||
Capability.AUDIO_TRACK_DATA, Attribute.AUDIO_TRACK_DATA
|
||||
)
|
||||
)
|
||||
) is None:
|
||||
is None
|
||||
):
|
||||
return None
|
||||
return track_data.get("title", None)
|
||||
|
||||
@ -252,10 +255,14 @@ class SmartThingsMediaPlayer(SmartThingsEntity, MediaPlayerEntity):
|
||||
def media_artist(self) -> str | None:
|
||||
"""Artist of current playing media."""
|
||||
if (
|
||||
track_data := self.get_attribute_value(
|
||||
Capability.AUDIO_TRACK_DATA, Attribute.AUDIO_TRACK_DATA
|
||||
not self.supports_capability(Capability.AUDIO_TRACK_DATA)
|
||||
or (
|
||||
track_data := self.get_attribute_value(
|
||||
Capability.AUDIO_TRACK_DATA, Attribute.AUDIO_TRACK_DATA
|
||||
)
|
||||
)
|
||||
) is None:
|
||||
is None
|
||||
):
|
||||
return None
|
||||
return track_data.get("artist")
|
||||
|
||||
|
@ -231,3 +231,68 @@
|
||||
'state': 'on',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[vd_stv_2017_k][media_player.tv_samsung_8_series_49-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'source_list': list([
|
||||
'digitalTv',
|
||||
'HDMI1',
|
||||
'HDMI4',
|
||||
'HDMI4',
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'media_player',
|
||||
'entity_category': None,
|
||||
'entity_id': 'media_player.tv_samsung_8_series_49',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <MediaPlayerDeviceClass.TV: 'tv'>,
|
||||
'original_icon': None,
|
||||
'original_name': None,
|
||||
'platform': 'smartthings',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': <MediaPlayerEntityFeature: 23997>,
|
||||
'translation_key': None,
|
||||
'unique_id': '4588d2d9-a8cf-40f4-9a0b-ed5dfbaccda1',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[vd_stv_2017_k][media_player.tv_samsung_8_series_49-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'tv',
|
||||
'friendly_name': '[TV] Samsung 8 Series (49)',
|
||||
'is_volume_muted': True,
|
||||
'source': 'HDMI1',
|
||||
'source_list': list([
|
||||
'digitalTv',
|
||||
'HDMI1',
|
||||
'HDMI4',
|
||||
'HDMI4',
|
||||
]),
|
||||
'supported_features': <MediaPlayerEntityFeature: 23997>,
|
||||
'volume_level': 0.13,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'media_player.tv_samsung_8_series_49',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'on',
|
||||
})
|
||||
# ---
|
||||
|
Loading…
x
Reference in New Issue
Block a user