mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +00:00
Add HDR type attribute to Kodi (#109603)
Co-authored-by: Andriy Kushnir <me@orhideous.name> Co-authored-by: Erik Montnemery <erik@montnemery.com>
This commit is contained in:
parent
a3b60cb054
commit
26ab4ad918
@ -259,6 +259,7 @@ class KodiEntity(MediaPlayerEntity):
|
||||
|
||||
_attr_has_entity_name = True
|
||||
_attr_name = None
|
||||
_attr_translation_key = "media_player"
|
||||
_attr_supported_features = (
|
||||
MediaPlayerEntityFeature.BROWSE_MEDIA
|
||||
| MediaPlayerEntityFeature.NEXT_TRACK
|
||||
@ -516,6 +517,7 @@ class KodiEntity(MediaPlayerEntity):
|
||||
"album",
|
||||
"season",
|
||||
"episode",
|
||||
"streamdetails",
|
||||
],
|
||||
)
|
||||
else:
|
||||
@ -632,6 +634,23 @@ class KodiEntity(MediaPlayerEntity):
|
||||
|
||||
return None
|
||||
|
||||
@property
|
||||
def extra_state_attributes(self) -> dict[str, str | None]:
|
||||
"""Return the state attributes."""
|
||||
state_attr: dict[str, str | None] = {}
|
||||
if self.state == MediaPlayerState.OFF:
|
||||
return state_attr
|
||||
|
||||
hdr_type = (
|
||||
self._item.get("streamdetails", {}).get("video", [{}])[0].get("hdrtype")
|
||||
)
|
||||
if hdr_type == "":
|
||||
state_attr["dynamic_range"] = "sdr"
|
||||
else:
|
||||
state_attr["dynamic_range"] = hdr_type
|
||||
|
||||
return state_attr
|
||||
|
||||
async def async_turn_on(self) -> None:
|
||||
"""Turn the media player on."""
|
||||
_LOGGER.debug("Firing event to turn on device")
|
||||
|
@ -83,5 +83,14 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"media_player": {
|
||||
"media_player": {
|
||||
"state_attributes": {
|
||||
"dynamic_range": { "name": "Dynamic range" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user