mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Bump aiowebostv to 0.5.0 (#136097)
This commit is contained in:
parent
a84335ae6d
commit
8d99a54656
@ -9,12 +9,7 @@ from urllib.parse import urlparse
|
||||
from aiowebostv import WebOsTvPairError
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.config_entries import (
|
||||
ConfigEntry,
|
||||
ConfigFlow,
|
||||
ConfigFlowResult,
|
||||
OptionsFlow,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult, OptionsFlow
|
||||
from homeassistant.const import CONF_CLIENT_SECRET, CONF_HOST
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
@ -24,7 +19,7 @@ from homeassistant.helpers.service_info.ssdp import (
|
||||
SsdpServiceInfo,
|
||||
)
|
||||
|
||||
from . import async_control_connect
|
||||
from . import WebOsTvConfigEntry, async_control_connect
|
||||
from .const import CONF_SOURCES, DEFAULT_NAME, DOMAIN, WEBOSTV_EXCEPTIONS
|
||||
from .helpers import async_get_sources
|
||||
|
||||
@ -49,7 +44,7 @@ class FlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
|
||||
@staticmethod
|
||||
@callback
|
||||
def async_get_options_flow(config_entry: ConfigEntry) -> OptionsFlow:
|
||||
def async_get_options_flow(config_entry: WebOsTvConfigEntry) -> OptionsFlow:
|
||||
"""Get the options flow for this handler."""
|
||||
return OptionsFlowHandler(config_entry)
|
||||
|
||||
@ -186,7 +181,7 @@ class FlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
class OptionsFlowHandler(OptionsFlow):
|
||||
"""Handle options."""
|
||||
|
||||
def __init__(self, config_entry: ConfigEntry) -> None:
|
||||
def __init__(self, config_entry: WebOsTvConfigEntry) -> None:
|
||||
"""Initialize options flow."""
|
||||
self.host = config_entry.data[CONF_HOST]
|
||||
self.key = config_entry.data[CONF_CLIENT_SECRET]
|
||||
|
@ -9,7 +9,7 @@ from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
from homeassistant.helpers.device_registry import DeviceEntry
|
||||
|
||||
from . import async_control_connect
|
||||
from . import WebOsTvConfigEntry, async_control_connect
|
||||
from .const import DOMAIN, LIVE_TV_APP_ID, WEBOSTV_EXCEPTIONS
|
||||
|
||||
|
||||
@ -56,7 +56,9 @@ def async_get_client_by_device_entry(
|
||||
Raises ValueError if client is not found.
|
||||
"""
|
||||
for config_entry_id in device.config_entries:
|
||||
entry = hass.config_entries.async_get_entry(config_entry_id)
|
||||
entry: WebOsTvConfigEntry | None = hass.config_entries.async_get_entry(
|
||||
config_entry_id
|
||||
)
|
||||
if entry and entry.domain == DOMAIN:
|
||||
if entry.state is ConfigEntryState.LOADED:
|
||||
return entry.runtime_data
|
||||
|
@ -6,7 +6,7 @@
|
||||
"documentation": "https://www.home-assistant.io/integrations/webostv",
|
||||
"iot_class": "local_push",
|
||||
"loggers": ["aiowebostv"],
|
||||
"requirements": ["aiowebostv==0.4.2"],
|
||||
"requirements": ["aiowebostv==0.5.0"],
|
||||
"ssdp": [
|
||||
{
|
||||
"st": "urn:lge-com:service:webos-second-screen:1"
|
||||
|
@ -196,7 +196,7 @@ class LgWebOSMediaPlayerEntity(RestoreEntity, MediaPlayerEntity):
|
||||
|
||||
self._attr_volume_level = None
|
||||
if self._client.volume is not None:
|
||||
self._attr_volume_level = cast(float, self._client.volume / 100.0)
|
||||
self._attr_volume_level = self._client.volume / 100.0
|
||||
|
||||
self._attr_source = self._current_source
|
||||
self._attr_source_list = sorted(self._source_list)
|
||||
@ -240,13 +240,9 @@ class LgWebOSMediaPlayerEntity(RestoreEntity, MediaPlayerEntity):
|
||||
)
|
||||
|
||||
self._attr_assumed_state = True
|
||||
if (
|
||||
self._client.is_on
|
||||
and self._client.media_state is not None
|
||||
and self._client.media_state.get("foregroundAppInfo") is not None
|
||||
):
|
||||
if self._client.is_on and self._client.media_state:
|
||||
self._attr_assumed_state = False
|
||||
for entry in self._client.media_state.get("foregroundAppInfo"):
|
||||
for entry in self._client.media_state:
|
||||
if entry.get("playState") == "playing":
|
||||
self._attr_state = MediaPlayerState.PLAYING
|
||||
elif entry.get("playState") == "paused":
|
||||
@ -254,7 +250,7 @@ class LgWebOSMediaPlayerEntity(RestoreEntity, MediaPlayerEntity):
|
||||
elif entry.get("playState") == "unloaded":
|
||||
self._attr_state = MediaPlayerState.IDLE
|
||||
|
||||
if self._client.system_info is not None or self.state != MediaPlayerState.OFF:
|
||||
if self.state != MediaPlayerState.OFF:
|
||||
maj_v = self._client.software_info.get("major_ver")
|
||||
min_v = self._client.software_info.get("minor_ver")
|
||||
if maj_v and min_v:
|
||||
@ -406,7 +402,7 @@ class LgWebOSMediaPlayerEntity(RestoreEntity, MediaPlayerEntity):
|
||||
"""Play a piece of media."""
|
||||
_LOGGER.debug("Call play media type <%s>, Id <%s>", media_type, media_id)
|
||||
|
||||
if media_type == MediaType.CHANNEL:
|
||||
if media_type == MediaType.CHANNEL and self._client.channels:
|
||||
_LOGGER.debug("Searching channel")
|
||||
partial_match_channel_id = None
|
||||
perfect_match_channel_id = None
|
||||
|
@ -77,6 +77,4 @@ rules:
|
||||
inject-websession:
|
||||
status: todo
|
||||
comment: need to check if it is needed for websockets or migrate to aiohttp
|
||||
strict-typing:
|
||||
status: todo
|
||||
comment: aiowebostv is not fully typed
|
||||
strict-typing: done
|
||||
|
2
requirements_all.txt
generated
2
requirements_all.txt
generated
@ -416,7 +416,7 @@ aiowaqi==3.1.0
|
||||
aiowatttime==0.1.1
|
||||
|
||||
# homeassistant.components.webostv
|
||||
aiowebostv==0.4.2
|
||||
aiowebostv==0.5.0
|
||||
|
||||
# homeassistant.components.withings
|
||||
aiowithings==3.1.4
|
||||
|
2
requirements_test_all.txt
generated
2
requirements_test_all.txt
generated
@ -398,7 +398,7 @@ aiowaqi==3.1.0
|
||||
aiowatttime==0.1.1
|
||||
|
||||
# homeassistant.components.webostv
|
||||
aiowebostv==0.4.2
|
||||
aiowebostv==0.5.0
|
||||
|
||||
# homeassistant.components.withings
|
||||
aiowithings==3.1.4
|
||||
|
@ -820,15 +820,15 @@ async def test_update_media_state(hass: HomeAssistant, client) -> None:
|
||||
"""Test updating media state."""
|
||||
await setup_webostv(hass)
|
||||
|
||||
client.media_state = {"foregroundAppInfo": [{"playState": "playing"}]}
|
||||
client.media_state = [{"playState": "playing"}]
|
||||
await client.mock_state_update()
|
||||
assert hass.states.get(ENTITY_ID).state == MediaPlayerState.PLAYING
|
||||
|
||||
client.media_state = {"foregroundAppInfo": [{"playState": "paused"}]}
|
||||
client.media_state = [{"playState": "paused"}]
|
||||
await client.mock_state_update()
|
||||
assert hass.states.get(ENTITY_ID).state == MediaPlayerState.PAUSED
|
||||
|
||||
client.media_state = {"foregroundAppInfo": [{"playState": "unloaded"}]}
|
||||
client.media_state = [{"playState": "unloaded"}]
|
||||
await client.mock_state_update()
|
||||
assert hass.states.get(ENTITY_ID).state == MediaPlayerState.IDLE
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user