mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 02:49:40 +00:00
Avoid using coordinator in config flow of APCUPSD (#112121)
* Separate data class out of coordinator * Further fix the imports * Update homeassistant/components/apcupsd/coordinator.py Co-authored-by: J. Nick Koston <nick@koston.org> * Use `or` to make it a bit cleaner when trying to find the UPS model Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com> * Use or to make it a bit cleaner when trying to find the UPS model Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com> * Use plain dict instead of `OrderedDict` --------- Co-authored-by: J. Nick Koston <nick@koston.org> Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
This commit is contained in:
@@ -24,7 +24,8 @@ from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from . import DOMAIN, APCUPSdCoordinator
|
||||
from .const import DOMAIN
|
||||
from .coordinator import APCUPSdCoordinator
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@@ -493,7 +494,7 @@ class APCUPSdSensor(CoordinatorEntity[APCUPSdCoordinator], SensorEntity):
|
||||
super().__init__(coordinator=coordinator, context=description.key.upper())
|
||||
|
||||
# Set up unique id and device info if serial number is available.
|
||||
if (serial_no := coordinator.ups_serial_no) is not None:
|
||||
if (serial_no := coordinator.data.serial_no) is not None:
|
||||
self._attr_unique_id = f"{serial_no}_{description.key}"
|
||||
|
||||
self.entity_description = description
|
||||
|
||||
Reference in New Issue
Block a user