mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Add name to Withings coordinator (#103692)
This commit is contained in:
parent
9af5e838c6
commit
1a6c3a4944
@ -37,11 +37,15 @@ class WithingsDataUpdateCoordinator(DataUpdateCoordinator[_T]):
|
|||||||
_default_update_interval: timedelta | None = UPDATE_INTERVAL
|
_default_update_interval: timedelta | None = UPDATE_INTERVAL
|
||||||
_last_valid_update: datetime | None = None
|
_last_valid_update: datetime | None = None
|
||||||
webhooks_connected: bool = False
|
webhooks_connected: bool = False
|
||||||
|
coordinator_name: str = ""
|
||||||
|
|
||||||
def __init__(self, hass: HomeAssistant, client: WithingsClient) -> None:
|
def __init__(self, hass: HomeAssistant, client: WithingsClient) -> None:
|
||||||
"""Initialize the Withings data coordinator."""
|
"""Initialize the Withings data coordinator."""
|
||||||
super().__init__(
|
super().__init__(
|
||||||
hass, LOGGER, name="Withings", update_interval=self._default_update_interval
|
hass,
|
||||||
|
LOGGER,
|
||||||
|
name=f"Withings {self.coordinator_name}",
|
||||||
|
update_interval=self._default_update_interval,
|
||||||
)
|
)
|
||||||
self._client = client
|
self._client = client
|
||||||
self.notification_categories: set[NotificationCategory] = set()
|
self.notification_categories: set[NotificationCategory] = set()
|
||||||
@ -77,6 +81,8 @@ class WithingsMeasurementDataUpdateCoordinator(
|
|||||||
):
|
):
|
||||||
"""Withings measurement coordinator."""
|
"""Withings measurement coordinator."""
|
||||||
|
|
||||||
|
coordinator_name: str = "measurements"
|
||||||
|
|
||||||
def __init__(self, hass: HomeAssistant, client: WithingsClient) -> None:
|
def __init__(self, hass: HomeAssistant, client: WithingsClient) -> None:
|
||||||
"""Initialize the Withings data coordinator."""
|
"""Initialize the Withings data coordinator."""
|
||||||
super().__init__(hass, client)
|
super().__init__(hass, client)
|
||||||
@ -109,6 +115,8 @@ class WithingsSleepDataUpdateCoordinator(
|
|||||||
):
|
):
|
||||||
"""Withings sleep coordinator."""
|
"""Withings sleep coordinator."""
|
||||||
|
|
||||||
|
coordinator_name: str = "sleep"
|
||||||
|
|
||||||
def __init__(self, hass: HomeAssistant, client: WithingsClient) -> None:
|
def __init__(self, hass: HomeAssistant, client: WithingsClient) -> None:
|
||||||
"""Initialize the Withings data coordinator."""
|
"""Initialize the Withings data coordinator."""
|
||||||
super().__init__(hass, client)
|
super().__init__(hass, client)
|
||||||
@ -156,6 +164,7 @@ class WithingsSleepDataUpdateCoordinator(
|
|||||||
class WithingsBedPresenceDataUpdateCoordinator(WithingsDataUpdateCoordinator[None]):
|
class WithingsBedPresenceDataUpdateCoordinator(WithingsDataUpdateCoordinator[None]):
|
||||||
"""Withings bed presence coordinator."""
|
"""Withings bed presence coordinator."""
|
||||||
|
|
||||||
|
coordinator_name: str = "bed presence"
|
||||||
in_bed: bool | None = None
|
in_bed: bool | None = None
|
||||||
_default_update_interval = None
|
_default_update_interval = None
|
||||||
|
|
||||||
@ -181,6 +190,7 @@ class WithingsBedPresenceDataUpdateCoordinator(WithingsDataUpdateCoordinator[Non
|
|||||||
class WithingsGoalsDataUpdateCoordinator(WithingsDataUpdateCoordinator[Goals]):
|
class WithingsGoalsDataUpdateCoordinator(WithingsDataUpdateCoordinator[Goals]):
|
||||||
"""Withings goals coordinator."""
|
"""Withings goals coordinator."""
|
||||||
|
|
||||||
|
coordinator_name: str = "goals"
|
||||||
_default_update_interval = timedelta(hours=1)
|
_default_update_interval = timedelta(hours=1)
|
||||||
|
|
||||||
def webhook_subscription_listener(self, connected: bool) -> None:
|
def webhook_subscription_listener(self, connected: bool) -> None:
|
||||||
@ -197,6 +207,7 @@ class WithingsActivityDataUpdateCoordinator(
|
|||||||
):
|
):
|
||||||
"""Withings activity coordinator."""
|
"""Withings activity coordinator."""
|
||||||
|
|
||||||
|
coordinator_name: str = "activity"
|
||||||
_previous_data: Activity | None = None
|
_previous_data: Activity | None = None
|
||||||
|
|
||||||
def __init__(self, hass: HomeAssistant, client: WithingsClient) -> None:
|
def __init__(self, hass: HomeAssistant, client: WithingsClient) -> None:
|
||||||
@ -235,6 +246,7 @@ class WithingsWorkoutDataUpdateCoordinator(
|
|||||||
):
|
):
|
||||||
"""Withings workout coordinator."""
|
"""Withings workout coordinator."""
|
||||||
|
|
||||||
|
coordinator_name: str = "workout"
|
||||||
_previous_data: Workout | None = None
|
_previous_data: Workout | None = None
|
||||||
|
|
||||||
def __init__(self, hass: HomeAssistant, client: WithingsClient) -> None:
|
def __init__(self, hass: HomeAssistant, client: WithingsClient) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user