mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Move to asyncio.timeout for APC integration (#104340)
Move to asyncio.timeout for apcupsd
This commit is contained in:
parent
33c5d1855d
commit
91e0a53cb2
@ -1,13 +1,13 @@
|
|||||||
"""Support for APCUPSd via its Network Information Server (NIS)."""
|
"""Support for APCUPSd via its Network Information Server (NIS)."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import asyncio
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
from typing import Final
|
from typing import Final
|
||||||
|
|
||||||
from apcaccess import status
|
from apcaccess import status
|
||||||
import async_timeout
|
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_HOST, CONF_PORT, Platform
|
from homeassistant.const import CONF_HOST, CONF_PORT, Platform
|
||||||
@ -121,7 +121,7 @@ class APCUPSdCoordinator(DataUpdateCoordinator[OrderedDict[str, str]]):
|
|||||||
integration uses lower cases as keys internally.
|
integration uses lower cases as keys internally.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
async with async_timeout.timeout(10):
|
async with asyncio.timeout(10):
|
||||||
try:
|
try:
|
||||||
raw = await self.hass.async_add_executor_job(
|
raw = await self.hass.async_add_executor_job(
|
||||||
status.get, self._host, self._port
|
status.get, self._host, self._port
|
||||||
|
Loading…
x
Reference in New Issue
Block a user