mirror of
https://github.com/home-assistant/core.git
synced 2025-08-04 05:05:09 +02:00
Add timeout (#71499)
This commit is contained in:
@@ -4,6 +4,7 @@ from __future__ import annotations
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
import async_timeout
|
||||
from brother import Brother, DictToObj, SnmpError, UnsupportedModel
|
||||
import pysnmp.hlapi.asyncio as SnmpEngine
|
||||
|
||||
@@ -76,6 +77,7 @@ class BrotherDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
async def _async_update_data(self) -> DictToObj:
|
||||
"""Update data via library."""
|
||||
try:
|
||||
async with async_timeout.timeout(20):
|
||||
data = await self.brother.async_update()
|
||||
except (ConnectionError, SnmpError, UnsupportedModel) as error:
|
||||
raise UpdateFailed(error) from error
|
||||
|
Reference in New Issue
Block a user