run async_hwinfo_update after reconnect

This commit is contained in:
tomaae 2020-04-13 07:36:00 +02:00
parent 345211570a
commit 19e7174446
2 changed files with 22 additions and 3 deletions

View file

@ -245,10 +245,12 @@ class MikrotikControllerData:
async def async_hwinfo_update(self):
"""Update Mikrotik hardware info"""
try:
await asyncio.wait_for(self.lock.acquire(), timeout=10)
await asyncio.wait_for(self.lock.acquire(), timeout=30)
except:
return
_LOGGER.warning("Running async_hwinfo_update")
await self.hass.async_add_executor_job(self.get_capabilities)
await self.hass.async_add_executor_job(self.get_system_routerboard)
await self.hass.async_add_executor_job(self.get_system_resource)
@ -343,6 +345,9 @@ class MikrotikControllerData:
# ---------------------------
async def async_update(self):
"""Update Mikrotik data"""
if self.api.has_reconnected():
await self.async_hwinfo_update()
try:
await asyncio.wait_for(self.lock.acquire(), timeout=10)
except: