mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +00:00
Explicitly pass in the config_entry in verisure coordinator (#137879)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
52fb99f967
commit
dfa2c218e4
@ -49,14 +49,14 @@ class VerisureAlarm(
|
||||
name="Verisure Alarm",
|
||||
manufacturer="Verisure",
|
||||
model="VBox",
|
||||
identifiers={(DOMAIN, self.coordinator.entry.data[CONF_GIID])},
|
||||
identifiers={(DOMAIN, self.coordinator.config_entry.data[CONF_GIID])},
|
||||
configuration_url="https://mypages.verisure.com",
|
||||
)
|
||||
|
||||
@property
|
||||
def unique_id(self) -> str:
|
||||
"""Return the unique ID for this entity."""
|
||||
return self.coordinator.entry.data[CONF_GIID]
|
||||
return self.coordinator.config_entry.data[CONF_GIID]
|
||||
|
||||
async def _async_set_arm_state(
|
||||
self, state: str, command_data: dict[str, str | dict[str, str]]
|
||||
|
@ -62,7 +62,7 @@ class VerisureDoorWindowSensor(
|
||||
manufacturer="Verisure",
|
||||
model="Shock Sensor Detector",
|
||||
identifiers={(DOMAIN, self.serial_number)},
|
||||
via_device=(DOMAIN, self.coordinator.entry.data[CONF_GIID]),
|
||||
via_device=(DOMAIN, self.coordinator.config_entry.data[CONF_GIID]),
|
||||
configuration_url="https://mypages.verisure.com",
|
||||
)
|
||||
|
||||
@ -104,7 +104,7 @@ class VerisureEthernetStatus(
|
||||
@property
|
||||
def unique_id(self) -> str:
|
||||
"""Return the unique ID for this entity."""
|
||||
return f"{self.coordinator.entry.data[CONF_GIID]}_ethernet"
|
||||
return f"{self.coordinator.config_entry.data[CONF_GIID]}_ethernet"
|
||||
|
||||
@property
|
||||
def device_info(self) -> DeviceInfo:
|
||||
@ -113,7 +113,7 @@ class VerisureEthernetStatus(
|
||||
name="Verisure Alarm",
|
||||
manufacturer="Verisure",
|
||||
model="VBox",
|
||||
identifiers={(DOMAIN, self.coordinator.entry.data[CONF_GIID])},
|
||||
identifiers={(DOMAIN, self.coordinator.config_entry.data[CONF_GIID])},
|
||||
configuration_url="https://mypages.verisure.com",
|
||||
)
|
||||
|
||||
|
@ -75,7 +75,7 @@ class VerisureSmartcam(CoordinatorEntity[VerisureDataUpdateCoordinator], Camera)
|
||||
manufacturer="Verisure",
|
||||
model="SmartCam",
|
||||
identifiers={(DOMAIN, self.serial_number)},
|
||||
via_device=(DOMAIN, self.coordinator.entry.data[CONF_GIID]),
|
||||
via_device=(DOMAIN, self.coordinator.config_entry.data[CONF_GIID]),
|
||||
configuration_url="https://mypages.verisure.com",
|
||||
)
|
||||
|
||||
|
@ -25,10 +25,11 @@ from .const import CONF_GIID, DEFAULT_SCAN_INTERVAL, DOMAIN, LOGGER
|
||||
class VerisureDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
"""A Verisure Data Update Coordinator."""
|
||||
|
||||
config_entry: ConfigEntry
|
||||
|
||||
def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None:
|
||||
"""Initialize the Verisure hub."""
|
||||
self.imageseries: list[dict[str, str]] = []
|
||||
self.entry = entry
|
||||
self._overview: list[dict] = []
|
||||
|
||||
self.verisure = Verisure(
|
||||
@ -40,7 +41,11 @@ class VerisureDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
)
|
||||
|
||||
super().__init__(
|
||||
hass, LOGGER, name=DOMAIN, update_interval=DEFAULT_SCAN_INTERVAL
|
||||
hass,
|
||||
LOGGER,
|
||||
config_entry=entry,
|
||||
name=DOMAIN,
|
||||
update_interval=DEFAULT_SCAN_INTERVAL,
|
||||
)
|
||||
|
||||
async def async_login(self) -> bool:
|
||||
@ -55,7 +60,7 @@ class VerisureDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
return False
|
||||
|
||||
await self.hass.async_add_executor_job(
|
||||
self.verisure.set_giid, self.entry.data[CONF_GIID]
|
||||
self.verisure.set_giid, self.config_entry.data[CONF_GIID]
|
||||
)
|
||||
|
||||
return True
|
||||
|
@ -81,7 +81,7 @@ class VerisureDoorlock(CoordinatorEntity[VerisureDataUpdateCoordinator], LockEnt
|
||||
manufacturer="Verisure",
|
||||
model="Lockguard Smartlock",
|
||||
identifiers={(DOMAIN, self.serial_number)},
|
||||
via_device=(DOMAIN, self.coordinator.entry.data[CONF_GIID]),
|
||||
via_device=(DOMAIN, self.coordinator.config_entry.data[CONF_GIID]),
|
||||
configuration_url="https://mypages.verisure.com",
|
||||
)
|
||||
|
||||
@ -109,7 +109,7 @@ class VerisureDoorlock(CoordinatorEntity[VerisureDataUpdateCoordinator], LockEnt
|
||||
@property
|
||||
def code_format(self) -> str:
|
||||
"""Return the configured code format."""
|
||||
digits = self.coordinator.entry.options.get(
|
||||
digits = self.coordinator.config_entry.options.get(
|
||||
CONF_LOCK_CODE_DIGITS, DEFAULT_LOCK_CODE_DIGITS
|
||||
)
|
||||
return f"^\\d{{{digits}}}$"
|
||||
|
@ -72,7 +72,7 @@ class VerisureThermometer(
|
||||
manufacturer="Verisure",
|
||||
model=DEVICE_TYPE_NAME.get(device_type, device_type),
|
||||
identifiers={(DOMAIN, self.serial_number)},
|
||||
via_device=(DOMAIN, self.coordinator.entry.data[CONF_GIID]),
|
||||
via_device=(DOMAIN, self.coordinator.config_entry.data[CONF_GIID]),
|
||||
configuration_url="https://mypages.verisure.com",
|
||||
)
|
||||
|
||||
@ -122,7 +122,7 @@ class VerisureHygrometer(
|
||||
manufacturer="Verisure",
|
||||
model=DEVICE_TYPE_NAME.get(device_type, device_type),
|
||||
identifiers={(DOMAIN, self.serial_number)},
|
||||
via_device=(DOMAIN, self.coordinator.entry.data[CONF_GIID]),
|
||||
via_device=(DOMAIN, self.coordinator.config_entry.data[CONF_GIID]),
|
||||
configuration_url="https://mypages.verisure.com",
|
||||
)
|
||||
|
||||
|
@ -57,7 +57,7 @@ class VerisureSmartplug(CoordinatorEntity[VerisureDataUpdateCoordinator], Switch
|
||||
manufacturer="Verisure",
|
||||
model="SmartPlug",
|
||||
identifiers={(DOMAIN, self.serial_number)},
|
||||
via_device=(DOMAIN, self.coordinator.entry.data[CONF_GIID]),
|
||||
via_device=(DOMAIN, self.coordinator.config_entry.data[CONF_GIID]),
|
||||
configuration_url="https://mypages.verisure.com",
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user