mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 06:07:17 +00:00
Add hdmi input attribute to AndroidTV (#42571)
* bumps androidtv to 0.0.53 * add hdmi_input attribute to androidtv * update tests for hdmi_input attribute * chore: update docstrings
This commit is contained in:
parent
f16ccae78b
commit
60234ecf40
@ -4,7 +4,7 @@
|
|||||||
"documentation": "https://www.home-assistant.io/integrations/androidtv",
|
"documentation": "https://www.home-assistant.io/integrations/androidtv",
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"adb-shell[async]==0.2.1",
|
"adb-shell[async]==0.2.1",
|
||||||
"androidtv[async]==0.0.52",
|
"androidtv[async]==0.0.53",
|
||||||
"pure-python-adb[async]==0.3.0.dev0"
|
"pure-python-adb[async]==0.3.0.dev0"
|
||||||
],
|
],
|
||||||
"codeowners": ["@JeffLIrion"]
|
"codeowners": ["@JeffLIrion"]
|
||||||
|
@ -445,6 +445,7 @@ class ADBDevice(MediaPlayerEntity):
|
|||||||
self._current_app = None
|
self._current_app = None
|
||||||
self._sources = None
|
self._sources = None
|
||||||
self._state = None
|
self._state = None
|
||||||
|
self._hdmi_input = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def app_id(self):
|
def app_id(self):
|
||||||
@ -463,8 +464,11 @@ class ADBDevice(MediaPlayerEntity):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def device_state_attributes(self):
|
||||||
"""Provide the last ADB command's response as an attribute."""
|
"""Provide the last ADB command's response and the device's HDMI input as attributes."""
|
||||||
return {"adb_response": self._adb_response}
|
return {
|
||||||
|
"adb_response": self._adb_response,
|
||||||
|
"hdmi_input": self._hdmi_input,
|
||||||
|
}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def media_image_hash(self):
|
def media_image_hash(self):
|
||||||
@ -670,6 +674,7 @@ class AndroidTVDevice(ADBDevice):
|
|||||||
_,
|
_,
|
||||||
self._is_volume_muted,
|
self._is_volume_muted,
|
||||||
self._volume_level,
|
self._volume_level,
|
||||||
|
self._hdmi_input,
|
||||||
) = await self.aftv.update(self._get_sources)
|
) = await self.aftv.update(self._get_sources)
|
||||||
|
|
||||||
self._state = ANDROIDTV_STATES.get(state)
|
self._state = ANDROIDTV_STATES.get(state)
|
||||||
@ -743,10 +748,13 @@ class FireTVDevice(ADBDevice):
|
|||||||
if not self._available:
|
if not self._available:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Get the `state`, `current_app`, and `running_apps`.
|
# Get the `state`, `current_app`, `running_apps` and `hdmi_input`.
|
||||||
state, self._current_app, running_apps = await self.aftv.update(
|
(
|
||||||
self._get_sources
|
state,
|
||||||
)
|
self._current_app,
|
||||||
|
running_apps,
|
||||||
|
self._hdmi_input,
|
||||||
|
) = await self.aftv.update(self._get_sources)
|
||||||
|
|
||||||
self._state = ANDROIDTV_STATES.get(state)
|
self._state = ANDROIDTV_STATES.get(state)
|
||||||
if self._state is None:
|
if self._state is None:
|
||||||
|
@ -248,7 +248,7 @@ ambiclimate==0.2.1
|
|||||||
amcrest==1.7.0
|
amcrest==1.7.0
|
||||||
|
|
||||||
# homeassistant.components.androidtv
|
# homeassistant.components.androidtv
|
||||||
androidtv[async]==0.0.52
|
androidtv[async]==0.0.53
|
||||||
|
|
||||||
# homeassistant.components.anel_pwrctrl
|
# homeassistant.components.anel_pwrctrl
|
||||||
anel_pwrctrl-homeassistant==0.0.1.dev2
|
anel_pwrctrl-homeassistant==0.0.1.dev2
|
||||||
|
@ -155,7 +155,7 @@ airly==1.0.0
|
|||||||
ambiclimate==0.2.1
|
ambiclimate==0.2.1
|
||||||
|
|
||||||
# homeassistant.components.androidtv
|
# homeassistant.components.androidtv
|
||||||
androidtv[async]==0.0.52
|
androidtv[async]==0.0.53
|
||||||
|
|
||||||
# homeassistant.components.apns
|
# homeassistant.components.apns
|
||||||
apns2==0.3.0
|
apns2==0.3.0
|
||||||
|
@ -155,16 +155,16 @@ PATCH_ISFILE = patch("os.path.isfile", isfile)
|
|||||||
PATCH_ACCESS = patch("os.access", return_value=True)
|
PATCH_ACCESS = patch("os.access", return_value=True)
|
||||||
|
|
||||||
|
|
||||||
def patch_firetv_update(state, current_app, running_apps):
|
def patch_firetv_update(state, current_app, running_apps, hdmi_input):
|
||||||
"""Patch the `FireTV.update()` method."""
|
"""Patch the `FireTV.update()` method."""
|
||||||
return patch(
|
return patch(
|
||||||
"androidtv.firetv.firetv_async.FireTVAsync.update",
|
"androidtv.firetv.firetv_async.FireTVAsync.update",
|
||||||
return_value=(state, current_app, running_apps),
|
return_value=(state, current_app, running_apps, hdmi_input),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def patch_androidtv_update(
|
def patch_androidtv_update(
|
||||||
state, current_app, running_apps, device, is_volume_muted, volume_level
|
state, current_app, running_apps, device, is_volume_muted, volume_level, hdmi_input
|
||||||
):
|
):
|
||||||
"""Patch the `AndroidTV.update()` method."""
|
"""Patch the `AndroidTV.update()` method."""
|
||||||
return patch(
|
return patch(
|
||||||
@ -176,6 +176,7 @@ def patch_androidtv_update(
|
|||||||
device,
|
device,
|
||||||
is_volume_muted,
|
is_volume_muted,
|
||||||
volume_level,
|
volume_level,
|
||||||
|
hdmi_input,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -341,12 +341,14 @@ async def _test_sources(hass, config0):
|
|||||||
"hdmi",
|
"hdmi",
|
||||||
False,
|
False,
|
||||||
1,
|
1,
|
||||||
|
"HW5",
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
patch_update = patchers.patch_firetv_update(
|
patch_update = patchers.patch_firetv_update(
|
||||||
"playing",
|
"playing",
|
||||||
"com.app.test1",
|
"com.app.test1",
|
||||||
["com.app.test1", "com.app.test2", "com.app.test3", "com.app.test4"],
|
["com.app.test1", "com.app.test2", "com.app.test3", "com.app.test4"],
|
||||||
|
"HW5",
|
||||||
)
|
)
|
||||||
|
|
||||||
with patch_update:
|
with patch_update:
|
||||||
@ -365,12 +367,14 @@ async def _test_sources(hass, config0):
|
|||||||
"hdmi",
|
"hdmi",
|
||||||
True,
|
True,
|
||||||
0,
|
0,
|
||||||
|
"HW5",
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
patch_update = patchers.patch_firetv_update(
|
patch_update = patchers.patch_firetv_update(
|
||||||
"playing",
|
"playing",
|
||||||
"com.app.test2",
|
"com.app.test2",
|
||||||
["com.app.test2", "com.app.test1", "com.app.test3", "com.app.test4"],
|
["com.app.test2", "com.app.test1", "com.app.test3", "com.app.test4"],
|
||||||
|
"HW5",
|
||||||
)
|
)
|
||||||
|
|
||||||
with patch_update:
|
with patch_update:
|
||||||
@ -428,6 +432,7 @@ async def _test_exclude_sources(hass, config0, expected_sources):
|
|||||||
"hdmi",
|
"hdmi",
|
||||||
False,
|
False,
|
||||||
1,
|
1,
|
||||||
|
"HW5",
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
patch_update = patchers.patch_firetv_update(
|
patch_update = patchers.patch_firetv_update(
|
||||||
@ -440,6 +445,7 @@ async def _test_exclude_sources(hass, config0, expected_sources):
|
|||||||
"com.app.test4",
|
"com.app.test4",
|
||||||
"com.app.test5",
|
"com.app.test5",
|
||||||
],
|
],
|
||||||
|
"HW5",
|
||||||
)
|
)
|
||||||
|
|
||||||
with patch_update:
|
with patch_update:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user