Bump pyheos to v1.0.1 (#136604)
parent
107184b55f
commit
dfbb48552c
|
@ -5,7 +5,7 @@ The coordinator is responsible for refreshing data in response to system-wide ev
|
||||||
entities to update. Entities subscribe to entity-specific updates within the entity class itself.
|
entities to update. Entities subscribe to entity-specific updates within the entity class itself.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from collections.abc import Callable
|
from collections.abc import Callable, Sequence
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
@ -60,11 +60,11 @@ class HeosCoordinator(DataUpdateCoordinator[None]):
|
||||||
self._update_sources_pending: bool = False
|
self._update_sources_pending: bool = False
|
||||||
self._source_list: list[str] = []
|
self._source_list: list[str] = []
|
||||||
self._favorites: dict[int, MediaItem] = {}
|
self._favorites: dict[int, MediaItem] = {}
|
||||||
self._inputs: list[MediaItem] = []
|
self._inputs: Sequence[MediaItem] = []
|
||||||
super().__init__(hass, _LOGGER, config_entry=config_entry, name=DOMAIN)
|
super().__init__(hass, _LOGGER, config_entry=config_entry, name=DOMAIN)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def inputs(self) -> list[MediaItem]:
|
def inputs(self) -> Sequence[MediaItem]:
|
||||||
"""Get input sources across all devices."""
|
"""Get input sources across all devices."""
|
||||||
return self._inputs
|
return self._inputs
|
||||||
|
|
||||||
|
@ -133,8 +133,6 @@ class HeosCoordinator(DataUpdateCoordinator[None]):
|
||||||
assert data is not None
|
assert data is not None
|
||||||
if data.updated_player_ids:
|
if data.updated_player_ids:
|
||||||
self._async_update_player_ids(data.updated_player_ids)
|
self._async_update_player_ids(data.updated_player_ids)
|
||||||
elif event == const.EVENT_GROUPS_CHANGED:
|
|
||||||
await self._async_update_players()
|
|
||||||
elif (
|
elif (
|
||||||
event in (const.EVENT_SOURCES_CHANGED, const.EVENT_USER_CHANGED)
|
event in (const.EVENT_SOURCES_CHANGED, const.EVENT_USER_CHANGED)
|
||||||
and not self._update_sources_pending
|
and not self._update_sources_pending
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
"iot_class": "local_push",
|
"iot_class": "local_push",
|
||||||
"loggers": ["pyheos"],
|
"loggers": ["pyheos"],
|
||||||
"quality_scale": "silver",
|
"quality_scale": "silver",
|
||||||
"requirements": ["pyheos==1.0.0"],
|
"requirements": ["pyheos==1.0.1"],
|
||||||
"single_config_entry": true,
|
"single_config_entry": true,
|
||||||
"ssdp": [
|
"ssdp": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections.abc import Awaitable, Callable, Coroutine
|
from collections.abc import Awaitable, Callable, Coroutine
|
||||||
|
from datetime import datetime
|
||||||
from functools import reduce, wraps
|
from functools import reduce, wraps
|
||||||
from operator import ior
|
from operator import ior
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
@ -56,6 +57,7 @@ BASE_SUPPORTED_FEATURES = (
|
||||||
)
|
)
|
||||||
|
|
||||||
PLAY_STATE_TO_STATE = {
|
PLAY_STATE_TO_STATE = {
|
||||||
|
None: MediaPlayerState.IDLE,
|
||||||
PlayState.PLAY: MediaPlayerState.PLAYING,
|
PlayState.PLAY: MediaPlayerState.PLAYING,
|
||||||
PlayState.STOP: MediaPlayerState.IDLE,
|
PlayState.STOP: MediaPlayerState.IDLE,
|
||||||
PlayState.PAUSE: MediaPlayerState.PAUSED,
|
PlayState.PAUSE: MediaPlayerState.PAUSED,
|
||||||
|
@ -399,38 +401,40 @@ class HeosMediaPlayer(CoordinatorEntity[HeosCoordinator], MediaPlayerEntity):
|
||||||
return self._player.is_muted
|
return self._player.is_muted
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def media_album_name(self) -> str:
|
def media_album_name(self) -> str | None:
|
||||||
"""Album name of current playing media, music track only."""
|
"""Album name of current playing media, music track only."""
|
||||||
return self._player.now_playing_media.album
|
return self._player.now_playing_media.album
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def media_artist(self) -> str:
|
def media_artist(self) -> str | None:
|
||||||
"""Artist of current playing media, music track only."""
|
"""Artist of current playing media, music track only."""
|
||||||
return self._player.now_playing_media.artist
|
return self._player.now_playing_media.artist
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def media_content_id(self) -> str:
|
def media_content_id(self) -> str | None:
|
||||||
"""Content ID of current playing media."""
|
"""Content ID of current playing media."""
|
||||||
return self._player.now_playing_media.media_id
|
return self._player.now_playing_media.media_id
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def media_duration(self):
|
def media_duration(self) -> int | None:
|
||||||
"""Duration of current playing media in seconds."""
|
"""Duration of current playing media in seconds."""
|
||||||
duration = self._player.now_playing_media.duration
|
duration = self._player.now_playing_media.duration
|
||||||
if isinstance(duration, int):
|
if isinstance(duration, int):
|
||||||
return duration / 1000
|
return int(duration / 1000)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def media_position(self):
|
def media_position(self) -> int | None:
|
||||||
"""Position of current playing media in seconds."""
|
"""Position of current playing media in seconds."""
|
||||||
# Some media doesn't have duration but reports position, return None
|
# Some media doesn't have duration but reports position, return None
|
||||||
if not self._player.now_playing_media.duration:
|
if not self._player.now_playing_media.duration:
|
||||||
return None
|
return None
|
||||||
return self._player.now_playing_media.current_position / 1000
|
if isinstance(self._player.now_playing_media.current_position, int):
|
||||||
|
return int(self._player.now_playing_media.current_position / 1000)
|
||||||
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def media_position_updated_at(self):
|
def media_position_updated_at(self) -> datetime | None:
|
||||||
"""When was the position of the current playing media valid."""
|
"""When was the position of the current playing media valid."""
|
||||||
# Some media doesn't have duration but reports position, return None
|
# Some media doesn't have duration but reports position, return None
|
||||||
if not self._player.now_playing_media.duration:
|
if not self._player.now_playing_media.duration:
|
||||||
|
@ -445,7 +449,7 @@ class HeosMediaPlayer(CoordinatorEntity[HeosCoordinator], MediaPlayerEntity):
|
||||||
return image_url if image_url else None
|
return image_url if image_url else None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def media_title(self) -> str:
|
def media_title(self) -> str | None:
|
||||||
"""Title of current playing media."""
|
"""Title of current playing media."""
|
||||||
return self._player.now_playing_media.song
|
return self._player.now_playing_media.song
|
||||||
|
|
||||||
|
|
|
@ -1980,7 +1980,7 @@ pygti==0.9.4
|
||||||
pyhaversion==22.8.0
|
pyhaversion==22.8.0
|
||||||
|
|
||||||
# homeassistant.components.heos
|
# homeassistant.components.heos
|
||||||
pyheos==1.0.0
|
pyheos==1.0.1
|
||||||
|
|
||||||
# homeassistant.components.hive
|
# homeassistant.components.hive
|
||||||
pyhive-integration==1.0.1
|
pyhive-integration==1.0.1
|
||||||
|
|
|
@ -1609,7 +1609,7 @@ pygti==0.9.4
|
||||||
pyhaversion==22.8.0
|
pyhaversion==22.8.0
|
||||||
|
|
||||||
# homeassistant.components.heos
|
# homeassistant.components.heos
|
||||||
pyheos==1.0.0
|
pyheos==1.0.1
|
||||||
|
|
||||||
# homeassistant.components.hive
|
# homeassistant.components.hive
|
||||||
pyhive-integration==1.0.1
|
pyhive-integration==1.0.1
|
||||||
|
|
Loading…
Reference in New Issue