mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-07-02 13:34:30 +02:00
run async_hwinfo_update after reconnect
This commit is contained in:
parent
345211570a
commit
19e7174446
2 changed files with 22 additions and 3 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue