Move to asyncio.timeout for APC integration (#104340)

Move to asyncio.timeout for apcupsd
This commit is contained in:
Klaas Schoute 2023-11-21 23:29:46 +01:00 committed by GitHub
parent 33c5d1855d
commit 91e0a53cb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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