mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Explicitly pass in the config_entry in withings coordinator (#137866)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
4d5987fa80
commit
0ecff272f2
@ -120,13 +120,17 @@ async def async_setup_entry(hass: HomeAssistant, entry: WithingsConfigEntry) ->
|
||||
client.refresh_token_function = _refresh_token
|
||||
withings_data = WithingsData(
|
||||
client=client,
|
||||
measurement_coordinator=WithingsMeasurementDataUpdateCoordinator(hass, client),
|
||||
sleep_coordinator=WithingsSleepDataUpdateCoordinator(hass, client),
|
||||
bed_presence_coordinator=WithingsBedPresenceDataUpdateCoordinator(hass, client),
|
||||
goals_coordinator=WithingsGoalsDataUpdateCoordinator(hass, client),
|
||||
activity_coordinator=WithingsActivityDataUpdateCoordinator(hass, client),
|
||||
workout_coordinator=WithingsWorkoutDataUpdateCoordinator(hass, client),
|
||||
device_coordinator=WithingsDeviceDataUpdateCoordinator(hass, client),
|
||||
measurement_coordinator=WithingsMeasurementDataUpdateCoordinator(
|
||||
hass, entry, client
|
||||
),
|
||||
sleep_coordinator=WithingsSleepDataUpdateCoordinator(hass, entry, client),
|
||||
bed_presence_coordinator=WithingsBedPresenceDataUpdateCoordinator(
|
||||
hass, entry, client
|
||||
),
|
||||
goals_coordinator=WithingsGoalsDataUpdateCoordinator(hass, entry, client),
|
||||
activity_coordinator=WithingsActivityDataUpdateCoordinator(hass, entry, client),
|
||||
workout_coordinator=WithingsWorkoutDataUpdateCoordinator(hass, entry, client),
|
||||
device_coordinator=WithingsDeviceDataUpdateCoordinator(hass, entry, client),
|
||||
)
|
||||
|
||||
for coordinator in withings_data.coordinators:
|
||||
|
@ -44,11 +44,17 @@ class WithingsDataUpdateCoordinator[_DataT](DataUpdateCoordinator[_DataT]):
|
||||
webhooks_connected: bool = False
|
||||
coordinator_name: str = ""
|
||||
|
||||
def __init__(self, hass: HomeAssistant, client: WithingsClient) -> None:
|
||||
def __init__(
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
config_entry: WithingsConfigEntry,
|
||||
client: WithingsClient,
|
||||
) -> None:
|
||||
"""Initialize the Withings data coordinator."""
|
||||
super().__init__(
|
||||
hass,
|
||||
LOGGER,
|
||||
config_entry=config_entry,
|
||||
name="",
|
||||
update_interval=self._default_update_interval,
|
||||
)
|
||||
@ -95,9 +101,14 @@ class WithingsMeasurementDataUpdateCoordinator(
|
||||
|
||||
coordinator_name: str = "measurements"
|
||||
|
||||
def __init__(self, hass: HomeAssistant, client: WithingsClient) -> None:
|
||||
def __init__(
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
config_entry: WithingsConfigEntry,
|
||||
client: WithingsClient,
|
||||
) -> None:
|
||||
"""Initialize the Withings data coordinator."""
|
||||
super().__init__(hass, client)
|
||||
super().__init__(hass, config_entry, client)
|
||||
self.notification_categories = {
|
||||
NotificationCategory.WEIGHT,
|
||||
NotificationCategory.PRESSURE,
|
||||
@ -133,9 +144,14 @@ class WithingsSleepDataUpdateCoordinator(
|
||||
|
||||
coordinator_name: str = "sleep"
|
||||
|
||||
def __init__(self, hass: HomeAssistant, client: WithingsClient) -> None:
|
||||
def __init__(
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
config_entry: WithingsConfigEntry,
|
||||
client: WithingsClient,
|
||||
) -> None:
|
||||
"""Initialize the Withings data coordinator."""
|
||||
super().__init__(hass, client)
|
||||
super().__init__(hass, config_entry, client)
|
||||
self.notification_categories = {
|
||||
NotificationCategory.SLEEP,
|
||||
}
|
||||
@ -184,9 +200,14 @@ class WithingsBedPresenceDataUpdateCoordinator(WithingsDataUpdateCoordinator[Non
|
||||
in_bed: bool | None = None
|
||||
_default_update_interval = None
|
||||
|
||||
def __init__(self, hass: HomeAssistant, client: WithingsClient) -> None:
|
||||
def __init__(
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
config_entry: WithingsConfigEntry,
|
||||
client: WithingsClient,
|
||||
) -> None:
|
||||
"""Initialize the Withings data coordinator."""
|
||||
super().__init__(hass, client)
|
||||
super().__init__(hass, config_entry, client)
|
||||
self.notification_categories = {
|
||||
NotificationCategory.IN_BED,
|
||||
NotificationCategory.OUT_BED,
|
||||
@ -226,9 +247,14 @@ class WithingsActivityDataUpdateCoordinator(
|
||||
coordinator_name: str = "activity"
|
||||
_previous_data: Activity | None = None
|
||||
|
||||
def __init__(self, hass: HomeAssistant, client: WithingsClient) -> None:
|
||||
def __init__(
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
config_entry: WithingsConfigEntry,
|
||||
client: WithingsClient,
|
||||
) -> None:
|
||||
"""Initialize the Withings data coordinator."""
|
||||
super().__init__(hass, client)
|
||||
super().__init__(hass, config_entry, client)
|
||||
self.notification_categories = {
|
||||
NotificationCategory.ACTIVITY,
|
||||
}
|
||||
@ -265,9 +291,14 @@ class WithingsWorkoutDataUpdateCoordinator(
|
||||
coordinator_name: str = "workout"
|
||||
_previous_data: Workout | None = None
|
||||
|
||||
def __init__(self, hass: HomeAssistant, client: WithingsClient) -> None:
|
||||
def __init__(
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
config_entry: WithingsConfigEntry,
|
||||
client: WithingsClient,
|
||||
) -> None:
|
||||
"""Initialize the Withings data coordinator."""
|
||||
super().__init__(hass, client)
|
||||
super().__init__(hass, config_entry, client)
|
||||
self.notification_categories = {
|
||||
NotificationCategory.ACTIVITY,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user