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