Bumped python-garminconnect

This commit is contained in:
Ron Klinkien
2025-11-04 16:36:56 +00:00
parent dc5151c641
commit cb1422c22b
4 changed files with 31 additions and 23 deletions

View File

@@ -7,6 +7,6 @@
"documentation": "https://github.com/cyberjunky/home-assistant-garmin_connect", "documentation": "https://github.com/cyberjunky/home-assistant-garmin_connect",
"iot_class": "cloud_polling", "iot_class": "cloud_polling",
"issue_tracker": "https://github.com/cyberjunky/home-assistant-garmin_connect/issues", "issue_tracker": "https://github.com/cyberjunky/home-assistant-garmin_connect/issues",
"requirements": ["garminconnect>=0.2.27"], "requirements": ["garminconnect>=0.2.31"],
"version": "0.2.32" "version": "0.2.32"
} }

View File

@@ -162,6 +162,8 @@ async def async_setup_entry(
class GarminConnectSensor(CoordinatorEntity, SensorEntity): class GarminConnectSensor(CoordinatorEntity, SensorEntity):
"""Representation of a Garmin Connect Sensor.""" """Representation of a Garmin Connect Sensor."""
_attr_has_entity_name = True
def __init__( def __init__(
self, self,
coordinator, coordinator,
@@ -194,7 +196,7 @@ class GarminConnectSensor(CoordinatorEntity, SensorEntity):
def native_value(self): def native_value(self):
""" """
Return the current value of the sensor, applying type-specific formatting and conversions. Return the current value of the sensor, applying type-specific formatting and conversions.
For activity and badge sensors, returns the count. For last activity, returns the activity name. HRV status and stress qualifier values are capitalized. Duration and seconds values are converted from seconds to minutes, and mass values from grams to kilograms. For alarms, returns the next active alarm if available. Timestamp values are converted to timezone-aware datetime objects. Returns None if data is unavailable. For activity and badge sensors, returns the count. For last activity, returns the activity name. HRV status and stress qualifier values are capitalized. Duration and seconds values are converted from seconds to minutes, and mass values from grams to kilograms. For alarms, returns the next active alarm if available. Timestamp values are converted to timezone-aware datetime objects. Returns None if data is unavailable.
""" """
if not self.coordinator.data: if not self.coordinator.data:
@@ -245,7 +247,7 @@ class GarminConnectSensor(CoordinatorEntity, SensorEntity):
def extra_state_attributes(self): def extra_state_attributes(self):
""" """
Return additional state attributes for the sensor entity. Return additional state attributes for the sensor entity.
Includes the last sync timestamp and, depending on the sensor type, recent activities (up to 5), badges (up to 10), alarms, or HRV status details (excluding the status string). Returns an empty dictionary if no coordinator data is available. Includes the last sync timestamp and, depending on the sensor type, recent activities (up to 5), badges (up to 10), alarms, or HRV status details (excluding the status string). Returns an empty dictionary if no coordinator data is available.
""" """
if not self.coordinator.data: if not self.coordinator.data:
@@ -287,11 +289,13 @@ class GarminConnectSensor(CoordinatorEntity, SensorEntity):
@property @property
def device_info(self) -> DeviceInfo: def device_info(self) -> DeviceInfo:
"""Return device information.""" """Return device information."""
return { return DeviceInfo(
"identifiers": {(GARMIN_DOMAIN, self._unique_id)}, identifiers={(GARMIN_DOMAIN, self._unique_id)},
"name": "Garmin Connect", name="Garmin Connect",
"manufacturer": "Garmin Connect", manufacturer="Garmin",
} model="Garmin Connect",
entry_type=None,
)
@property @property
def entity_registry_enabled_default(self) -> bool: def entity_registry_enabled_default(self) -> bool:
@@ -310,9 +314,9 @@ class GarminConnectSensor(CoordinatorEntity, SensorEntity):
async def add_body_composition(self, **kwargs): async def add_body_composition(self, **kwargs):
""" """
Add a new body composition measurement to Garmin Connect. Add a new body composition measurement to Garmin Connect.
Extracts body composition metrics from keyword arguments and submits them to the Garmin Connect API. Ensures the user is logged in before attempting to add the record. Extracts body composition metrics from keyword arguments and submits them to the Garmin Connect API. Ensures the user is logged in before attempting to add the record.
Raises: Raises:
IntegrationError: If login to Garmin Connect fails. IntegrationError: If login to Garmin Connect fails.
""" """
@@ -357,14 +361,14 @@ class GarminConnectSensor(CoordinatorEntity, SensorEntity):
async def add_blood_pressure(self, **kwargs): async def add_blood_pressure(self, **kwargs):
""" """
Add a blood pressure measurement to Garmin Connect using the provided values. Add a blood pressure measurement to Garmin Connect using the provided values.
Parameters: Parameters:
systolic: Systolic blood pressure value. systolic: Systolic blood pressure value.
diastolic: Diastolic blood pressure value. diastolic: Diastolic blood pressure value.
pulse: Pulse rate. pulse: Pulse rate.
timestamp: Optional timestamp for the measurement. timestamp: Optional timestamp for the measurement.
notes: Optional notes for the measurement. notes: Optional notes for the measurement.
Raises: Raises:
IntegrationError: If unable to log in to Garmin Connect. IntegrationError: If unable to log in to Garmin Connect.
""" """
@@ -394,6 +398,8 @@ class GarminConnectSensor(CoordinatorEntity, SensorEntity):
class GarminConnectGearSensor(CoordinatorEntity, SensorEntity): class GarminConnectGearSensor(CoordinatorEntity, SensorEntity):
"""Representation of a Garmin Connect Gear Sensor.""" """Representation of a Garmin Connect Gear Sensor."""
_attr_has_entity_name = True
def __init__( def __init__(
self, self,
coordinator, coordinator,
@@ -442,7 +448,7 @@ class GarminConnectGearSensor(CoordinatorEntity, SensorEntity):
def extra_state_attributes(self): def extra_state_attributes(self):
""" """
Return additional state attributes for the gear sensor entity. Return additional state attributes for the gear sensor entity.
Includes metadata such as last sync time, total activities, creation and update dates, gear make/model/status, custom model, maximum distance, and a comma-separated list of activity types for which this gear is set as default. Returns an empty dictionary if required data is missing. Includes metadata such as last sync time, total activities, creation and update dates, gear make/model/status, custom model, maximum distance, and a comma-separated list of activity types for which this gear is set as default. Returns an empty dictionary if required data is missing.
""" """
gear = self._gear() gear = self._gear()
@@ -486,11 +492,13 @@ class GarminConnectGearSensor(CoordinatorEntity, SensorEntity):
@property @property
def device_info(self) -> DeviceInfo: def device_info(self) -> DeviceInfo:
"""Return device information.""" """Return device information."""
return { return DeviceInfo(
"identifiers": {(GARMIN_DOMAIN, self._unique_id)}, identifiers={(GARMIN_DOMAIN, self._unique_id)},
"name": "Garmin Connect", name="Garmin Connect",
"manufacturer": "Garmin Connect", manufacturer="Garmin",
} model="Garmin Connect",
entry_type=None,
)
@property @property
def entity_registry_enabled_default(self) -> bool: def entity_registry_enabled_default(self) -> bool:
@@ -517,7 +525,7 @@ class GarminConnectGearSensor(CoordinatorEntity, SensorEntity):
def _gear_defaults(self): def _gear_defaults(self):
""" """
Return a list of default gear settings for this gear UUID. Return a list of default gear settings for this gear UUID.
Returns: Returns:
List of gear default dictionaries where this gear is set as the default. List of gear default dictionaries where this gear is set as the default.
""" """
@@ -531,11 +539,11 @@ class GarminConnectGearSensor(CoordinatorEntity, SensorEntity):
async def set_active_gear(self, **kwargs): async def set_active_gear(self, **kwargs):
""" """
Set this gear as active or default for a specified activity type in Garmin Connect. Set this gear as active or default for a specified activity type in Garmin Connect.
Parameters: Parameters:
activity_type (str): The activity type key for which to update the gear setting. activity_type (str): The activity type key for which to update the gear setting.
setting (str): The desired gear setting, indicating whether to set as default or as the only default. setting (str): The desired gear setting, indicating whether to set as default or as the only default.
Raises: Raises:
IntegrationError: If unable to log in to Garmin Connect. IntegrationError: If unable to log in to Garmin Connect.
""" """

View File

@@ -1,6 +1,6 @@
{ {
"name": "Garmin Connect", "name": "Garmin Connect",
"render_readme": true, "render_readme": true,
"homeassistant": "2025.10.4", "homeassistant": "2025.1.4",
"hacs": "1.34.0" "hacs": "1.34.0"
} }

View File

@@ -1 +1 @@
homeassistant==2025.10.4 homeassistant==2025.1.4