Bump androidtv to 0.0.63 (fix MAC issues) (#65615)

pull/65838/head
Jeff Irion 2022-02-04 11:13:08 -08:00 committed by GitHub
parent d279211f0c
commit fe05d6680c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 99 additions and 49 deletions

View File

@ -124,6 +124,14 @@ class AndroidTVFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
return RESULT_CONN_ERROR, None
dev_prop = aftv.device_properties
_LOGGER.info(
"Android TV at %s: %s = %r, %s = %r",
user_input[CONF_HOST],
PROP_ETHMAC,
dev_prop.get(PROP_ETHMAC),
PROP_WIFIMAC,
dev_prop.get(PROP_WIFIMAC),
)
unique_id = format_mac(
dev_prop.get(PROP_ETHMAC) or dev_prop.get(PROP_WIFIMAC, "")
)

View File

@ -4,7 +4,7 @@
"documentation": "https://www.home-assistant.io/integrations/androidtv",
"requirements": [
"adb-shell[async]==0.4.0",
"androidtv[async]==0.0.62",
"androidtv[async]==0.0.63",
"pure-python-adb[async]==0.3.0.dev0"
],
"codeowners": ["@JeffLIrion", "@ollo69"],

View File

@ -311,7 +311,7 @@ ambiclimate==0.2.1
amcrest==1.9.3
# homeassistant.components.androidtv
androidtv[async]==0.0.62
androidtv[async]==0.0.63
# homeassistant.components.anel_pwrctrl
anel_pwrctrl-homeassistant==0.0.1.dev2

View File

@ -237,7 +237,7 @@ amberelectric==1.0.3
ambiclimate==0.2.1
# homeassistant.components.androidtv
androidtv[async]==0.0.62
androidtv[async]==0.0.63
# homeassistant.components.apns
apns2==0.3.0

View File

@ -185,3 +185,15 @@ PATCH_ANDROIDTV_UPDATE_EXCEPTION = patch(
"androidtv.androidtv.androidtv_async.AndroidTVAsync.update",
side_effect=ZeroDivisionError,
)
PATCH_DEVICE_PROPERTIES = patch(
"androidtv.basetv.basetv_async.BaseTVAsync.get_device_properties",
return_value={
"manufacturer": "a",
"model": "b",
"serialno": "c",
"sw_version": "d",
"wifimac": "ab:cd:ef:gh:ij:kl",
"ethmac": None,
},
)

View File

@ -157,8 +157,10 @@ async def test_setup_with_properties(hass):
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
patch_key
], patchers.patch_shell(response)[patch_key]:
with patchers.PATCH_DEVICE_PROPERTIES:
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
state = hass.states.get(entity_id)
assert state is not None
@ -188,6 +190,7 @@ async def test_reconnect(hass, caplog, config):
], patchers.patch_shell(SHELL_RESPONSE_OFF)[
patch_key
], patchers.PATCH_KEYGEN, patchers.PATCH_ANDROIDTV_OPEN, patchers.PATCH_SIGNER:
with patchers.PATCH_DEVICE_PROPERTIES:
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
@ -256,8 +259,10 @@ async def test_adb_shell_returns_none(hass, config):
], patchers.patch_shell(SHELL_RESPONSE_OFF)[
patch_key
], patchers.PATCH_KEYGEN, patchers.PATCH_ANDROIDTV_OPEN, patchers.PATCH_SIGNER:
with patchers.PATCH_DEVICE_PROPERTIES:
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
await hass.helpers.entity_component.async_update_entity(entity_id)
state = hass.states.get(entity_id)
assert state is not None
@ -284,8 +289,10 @@ async def test_setup_with_adbkey(hass):
], patchers.patch_shell(SHELL_RESPONSE_OFF)[
patch_key
], patchers.PATCH_ANDROIDTV_OPEN, patchers.PATCH_SIGNER, PATCH_ISFILE, PATCH_ACCESS:
with patchers.PATCH_DEVICE_PROPERTIES:
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
await hass.helpers.entity_component.async_update_entity(entity_id)
state = hass.states.get(entity_id)
assert state is not None
@ -317,8 +324,10 @@ async def test_sources(hass, config0):
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
patch_key
], patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
with patchers.PATCH_DEVICE_PROPERTIES:
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
await hass.helpers.entity_component.async_update_entity(entity_id)
state = hass.states.get(entity_id)
assert state is not None
@ -395,8 +404,10 @@ async def _test_exclude_sources(hass, config0, expected_sources):
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
patch_key
], patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
with patchers.PATCH_DEVICE_PROPERTIES:
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
await hass.helpers.entity_component.async_update_entity(entity_id)
state = hass.states.get(entity_id)
assert state is not None
@ -475,8 +486,10 @@ async def _test_select_source(hass, config0, source, expected_arg, method_patch)
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
patch_key
], patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
with patchers.PATCH_DEVICE_PROPERTIES:
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
await hass.helpers.entity_component.async_update_entity(entity_id)
state = hass.states.get(entity_id)
assert state is not None
@ -701,8 +714,10 @@ async def test_setup_fail(hass, config):
], patchers.patch_shell(SHELL_RESPONSE_OFF)[
patch_key
], patchers.PATCH_KEYGEN, patchers.PATCH_ANDROIDTV_OPEN, patchers.PATCH_SIGNER:
with patchers.PATCH_DEVICE_PROPERTIES:
assert await hass.config_entries.async_setup(config_entry.entry_id) is False
await hass.async_block_till_done()
await hass.helpers.entity_component.async_update_entity(entity_id)
state = hass.states.get(entity_id)
assert state is None
@ -718,6 +733,7 @@ async def test_adb_command(hass):
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
patch_key
], patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
with patchers.PATCH_DEVICE_PROPERTIES:
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
@ -747,6 +763,7 @@ async def test_adb_command_unicode_decode_error(hass):
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
patch_key
], patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
with patchers.PATCH_DEVICE_PROPERTIES:
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
@ -776,6 +793,7 @@ async def test_adb_command_key(hass):
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
patch_key
], patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
with patchers.PATCH_DEVICE_PROPERTIES:
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
@ -805,6 +823,7 @@ async def test_adb_command_get_properties(hass):
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
patch_key
], patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
with patchers.PATCH_DEVICE_PROPERTIES:
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
@ -834,6 +853,7 @@ async def test_learn_sendevent(hass):
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
patch_key
], patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
with patchers.PATCH_DEVICE_PROPERTIES:
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
@ -862,6 +882,7 @@ async def test_update_lock_not_acquired(hass):
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
patch_key
], patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
with patchers.PATCH_DEVICE_PROPERTIES:
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
@ -897,6 +918,7 @@ async def test_download(hass):
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
patch_key
], patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
with patchers.PATCH_DEVICE_PROPERTIES:
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
@ -943,6 +965,7 @@ async def test_upload(hass):
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
patch_key
], patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
with patchers.PATCH_DEVICE_PROPERTIES:
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
@ -987,6 +1010,7 @@ async def test_androidtv_volume_set(hass):
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
patch_key
], patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
with patchers.PATCH_DEVICE_PROPERTIES:
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
@ -1014,6 +1038,7 @@ async def test_get_image(hass, hass_ws_client):
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
patch_key
], patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
with patchers.PATCH_DEVICE_PROPERTIES:
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
@ -1090,6 +1115,7 @@ async def test_services_androidtv(hass):
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[patch_key]:
with patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
with patchers.PATCH_DEVICE_PROPERTIES:
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
@ -1136,6 +1162,7 @@ async def test_services_firetv(hass):
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[patch_key]:
with patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
with patchers.PATCH_DEVICE_PROPERTIES:
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
@ -1152,6 +1179,7 @@ async def test_volume_mute(hass):
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[patch_key]:
with patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
with patchers.PATCH_DEVICE_PROPERTIES:
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
@ -1196,6 +1224,7 @@ async def test_connection_closed_on_ha_stop(hass):
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
patch_key
], patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
with patchers.PATCH_DEVICE_PROPERTIES:
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
@ -1220,6 +1249,7 @@ async def test_exception(hass):
], patchers.patch_shell(SHELL_RESPONSE_OFF)[
patch_key
], patchers.PATCH_KEYGEN, patchers.PATCH_ANDROIDTV_OPEN, patchers.PATCH_SIGNER:
with patchers.PATCH_DEVICE_PROPERTIES:
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()