Bump androidtv to 0.0.67 (improve connect attempt logging) (#69721)

This commit is contained in:
Jeff Irion 2022-04-13 00:38:07 -07:00 committed by GitHub
parent ad5d7a845b
commit 0df30782a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 7 deletions

View file

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

View file

@ -251,6 +251,9 @@ class ADBDevice(MediaPlayerEntity):
ATTR_HDMI_INPUT: None,
}
# The number of consecutive failed connect attempts
self._failed_connect_count = 0
def _process_config(self):
"""Load the config options."""
_LOGGER.debug("Loading configuration options")
@ -450,9 +453,13 @@ class AndroidTVDevice(ADBDevice):
async def async_update(self):
"""Update the device state and, if necessary, re-connect."""
# Check if device is disconnected.
if not self.available:
if not self._attr_available:
# Try to connect
self._attr_available = await self.aftv.adb_connect(always_log_errors=False)
if await self.aftv.adb_connect(log_errors=self._failed_connect_count == 0):
self._failed_connect_count = 0
self._attr_available = True
else:
self._failed_connect_count += 1
# If the ADB connection is not intact, don't update.
if not self.available:
@ -535,9 +542,13 @@ class FireTVDevice(ADBDevice):
async def async_update(self):
"""Update the device state and, if necessary, re-connect."""
# Check if device is disconnected.
if not self.available:
if not self._attr_available:
# Try to connect
self._attr_available = await self.aftv.adb_connect(always_log_errors=False)
if await self.aftv.adb_connect(log_errors=self._failed_connect_count == 0):
self._failed_connect_count = 0
self._attr_available = True
else:
self._failed_connect_count += 1
# If the ADB connection is not intact, don't update.
if not self.available:

View file

@ -292,7 +292,7 @@ ambiclimate==0.2.1
amcrest==1.9.7
# homeassistant.components.androidtv
androidtv[async]==0.0.66
androidtv[async]==0.0.67
# homeassistant.components.anel_pwrctrl
anel_pwrctrl-homeassistant==0.0.1.dev2

View file

@ -249,7 +249,7 @@ amberelectric==1.0.4
ambiclimate==0.2.1
# homeassistant.components.androidtv
androidtv[async]==0.0.66
androidtv[async]==0.0.67
# homeassistant.components.apprise
apprise==0.9.7