mirror of
https://github.com/cyberjunky/home-assistant-garmin_connect.git
synced 2026-01-09 12:57:58 -05:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
891ddbce27 | ||
|
|
89222f0299 | ||
|
|
18304be84a | ||
|
|
ffd478cc60 | ||
|
|
4e6b9310a1 | ||
|
|
e9fba7abbe |
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 Ron Klinkien
|
||||
Copyright (c) 2023 Ron Klinkien
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# Garmin Connect
|
||||
The Garmin Connect integration allows you to expose data from Garmin Connect to Home Assistant.
|
||||
|
||||
NOTE: This integration doesn't support 2FA on Garmin Connect, so if you have enabled it -and want to keep it- this integration doesn't work, it will try to login repeatedly and generate lots of 2FA codes via email.
|
||||
NOTE: This integration doesn't support 2FA on Garmin Connect yet (support is coming), so if you have enabled it -and want to keep it- this integration doesn't work, it will try to login repeatedly and generate lots of 2FA codes via email.
|
||||
The change of adding support for it is unlikely since the Garmin Connect API is closed source, and will not be open for open-sourced projects.
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -133,6 +133,8 @@ class GarminConnectDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
gear_defaults = await self.hass.async_add_executor_job(
|
||||
self._api.get_gear_defaults, summary[GEAR.USERPROFILE_ID]
|
||||
)
|
||||
sleep_data = await self.hass.async_add_executor_job(
|
||||
self._api.get_sleep_data, date.today().isoformat())
|
||||
|
||||
except (
|
||||
GarminConnectAuthenticationError,
|
||||
@@ -144,6 +146,11 @@ class GarminConnectDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
raise UpdateFailed(error) from error
|
||||
return {}
|
||||
|
||||
sleep_score = None
|
||||
try:
|
||||
sleep_score = sleep_data["dailySleepDTO"]["sleepScores"]["overall"]["value"]
|
||||
except KeyError:
|
||||
_LOGGER.debug("sleepScore was absent")
|
||||
summary['lastActivities'] = activities
|
||||
|
||||
return {
|
||||
@@ -154,6 +161,7 @@ class GarminConnectDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
"gear_stats": gear_stats,
|
||||
"activity_types": activity_types,
|
||||
"gear_defaults": gear_defaults,
|
||||
"sleepScore": sleep_score,
|
||||
}
|
||||
|
||||
async def set_active_gear(self, entity, service_data):
|
||||
|
||||
@@ -401,7 +401,15 @@ GARMIN_ENTITY_LIST = {
|
||||
"visceralFat": ["Visceral Fat", PERCENTAGE, "mdi:food", None, SensorStateClass.TOTAL, False],
|
||||
"metabolicAge": ["Metabolic Age", TIME_YEARS, "mdi:calendar-heart", None, SensorStateClass.TOTAL, False],
|
||||
"nextAlarm": ["Next Alarm Time", None, "mdi:alarm", SensorDeviceClass.TIMESTAMP, None, True],
|
||||
"lastActivities": ["Last Activities", None, "mdi:numeric", SensorStateClass.TOTAL, None, False]
|
||||
"lastActivities": ["Last Activities", None, "mdi:numeric", SensorStateClass.TOTAL, None, False],
|
||||
"sleepScore": [
|
||||
"Sleep Score",
|
||||
None,
|
||||
"mdi:sleep",
|
||||
SensorStateClass.TOTAL,
|
||||
SensorStateClass.MEASUREMENT,
|
||||
True,
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
"documentation": "https://github.com/cyberjunky/home-assistant-garmin_connect",
|
||||
"issue_tracker": "https://github.com/cyberjunky/home-assistant-garmin_connect/issues",
|
||||
"iot_class": "cloud_polling",
|
||||
"requirements": ["garminconnect==0.1.55", "tzlocal"],
|
||||
"version": "0.2.16"
|
||||
"requirements": ["garminconnect==0.2.12", "tzlocal"],
|
||||
"version": "0.2.18"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user