Compare commits

...

51 Commits

Author SHA1 Message Date
Ron Klinkien
dbcb5d7103 Fixes related to hrvstatus and body composition data 2024-12-20 10:02:34 +01:00
Ron
3a14a7a108 Update hacs.json 2024-12-17 09:02:43 +01:00
Ron
5f9aeb4914 Merge pull request #210 from cyberjunky/dependabot/pip/vulture-2.14
Bump vulture from 2.11 to 2.14
2024-12-17 08:54:02 +01:00
dependabot[bot]
5934224198 Bump vulture from 2.11 to 2.14
Bumps [vulture](https://github.com/jendrikseipp/vulture) from 2.11 to 2.14.
- [Release notes](https://github.com/jendrikseipp/vulture/releases)
- [Changelog](https://github.com/jendrikseipp/vulture/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jendrikseipp/vulture/compare/v2.11...v2.14)

---
updated-dependencies:
- dependency-name: vulture
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-17 07:53:29 +00:00
Ron
fbbbf92728 Merge pull request #213 from cyberjunky/dependabot/pip/ruff-0.8.3
Bump ruff from 0.5.0 to 0.8.3
2024-12-17 08:52:45 +01:00
Ron
cd3190a799 Merge pull request #209 from cyberjunky/dependabot/pip/pre-commit-4.0.1
Bump pre-commit from 3.7.1 to 4.0.1
2024-12-17 08:52:21 +01:00
dependabot[bot]
4015141d23 Bump pre-commit from 3.7.1 to 4.0.1
Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.7.1 to 4.0.1.
- [Release notes](https://github.com/pre-commit/pre-commit/releases)
- [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md)
- [Commits](https://github.com/pre-commit/pre-commit/compare/v3.7.1...v4.0.1)

---
updated-dependencies:
- dependency-name: pre-commit
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-17 07:51:20 +00:00
dependabot[bot]
91cdd4ad77 Bump ruff from 0.5.0 to 0.8.3
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.5.0 to 0.8.3.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.5.0...0.8.3)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-17 07:51:17 +00:00
Ron
cdff89f2ca Merge pull request #208 from cyberjunky/dependabot/pip/pylint-3.3.2
Bump pylint from 3.2.5 to 3.3.2
2024-12-17 08:50:17 +01:00
Ron
689df3de94 Merge pull request #206 from cyberjunky/dependabot/pip/mypy-1.13.0
Bump mypy from 1.10.1 to 1.13.0
2024-12-17 08:50:06 +01:00
Ron
8c16842247 Merge pull request #157 from kruemelro/main
Always fetch latest data, added blood pressure service
2024-12-17 08:46:38 +01:00
Ron
fa0e60648f Merge pull request #204 from jfparis/hrv_status
Add a sensor to retreive HRV status when available
2024-12-17 08:40:48 +01:00
Ron
5a8fd38741 Merge pull request #203 from jfparis/measurement_units_v2
Correct states class of several entities
2024-12-17 08:37:10 +01:00
Ron Klinkien
f16f96e5de Pin garth version to 0.4.47 2024-12-12 08:32:30 +01:00
dependabot[bot]
25944ba0fe Bump pylint from 3.2.5 to 3.3.2
Bumps [pylint](https://github.com/pylint-dev/pylint) from 3.2.5 to 3.3.2.
- [Release notes](https://github.com/pylint-dev/pylint/releases)
- [Commits](https://github.com/pylint-dev/pylint/compare/v3.2.5...v3.3.2)

---
updated-dependencies:
- dependency-name: pylint
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-02 21:07:37 +00:00
dependabot[bot]
d3fa73c5a1 Bump mypy from 1.10.1 to 1.13.0
Bumps [mypy](https://github.com/python/mypy) from 1.10.1 to 1.13.0.
- [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md)
- [Commits](https://github.com/python/mypy/compare/v1.10.1...v1.13.0)

---
updated-dependencies:
- dependency-name: mypy
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-02 21:07:24 +00:00
Jean-François Paris
252f67ff7f Add a sensor to retreive HRV status when available 2024-11-28 10:50:59 +00:00
Jean-François Paris
b366807571 Gives body indicators related data the 'measurement' class 2024-11-27 21:36:32 +00:00
Jean-François Paris
437aae6d34 Gives respitation related data the 'measurement' class 2024-11-27 21:35:06 +00:00
Jean-François Paris
51ccb196c0 Gives SPO2 related data the 'measurement' class 2024-11-27 21:32:12 +00:00
Jean-François Paris
8de123eff2 Gives stress related data the 'measurement' class 2024-11-27 21:28:53 +00:00
Jean-François Paris
d4e9a4edc6 Gives heart rates related data the 'measurement' class 2024-11-27 21:22:15 +00:00
Ron Klinkien
5a5b42a560 Bumped version of garminconnect 2024-11-27 20:20:57 +01:00
Ron Klinkien
e2deaed42b Dev version, added garmin badges 2024-11-27 10:14:55 +01:00
Ron Klinkien
78b6641506 Updated sk.json 2024-11-27 10:14:17 +01:00
Ron Klinkien
29f0832e8b Updated LICENSE 2024-11-27 10:14:17 +01:00
Ron
07473ef701 Merge pull request #139 from kozerskil/badges
Added badges
2024-11-27 10:13:26 +01:00
Ron
b8156a6a7d Merge pull request #186 from cyberjunky/dependabot/pip/pylint-3.2.5
Bump pylint from 3.0.3 to 3.2.5
2024-11-27 09:41:25 +01:00
Ron
7546a40012 Merge branch 'main' into dependabot/pip/pylint-3.2.5 2024-11-27 09:40:48 +01:00
Ron
e6f7947e2c Merge pull request #187 from cyberjunky/dependabot/pip/ruff-0.5.0
Bump ruff from 0.3.5 to 0.5.0
2024-11-27 09:39:53 +01:00
Ron
dda115539f Merge branch 'main' into dependabot/pip/ruff-0.5.0 2024-11-27 09:39:41 +01:00
Ron
304cd1f227 Merge pull request #188 from cyberjunky/dependabot/pip/mypy-1.10.1
Bump mypy from 1.8.0 to 1.10.1
2024-11-27 09:38:59 +01:00
Ron
6dc64df4d9 Merge branch 'main' into dependabot/pip/mypy-1.10.1 2024-11-27 09:38:23 +01:00
Ron
c3af1cc392 Merge pull request #185 from cyberjunky/dependabot/pip/pip-gte-24.1.1-and-lt-24.2
Update pip requirement from <24.1,>=21.0 to >=24.1.1,<24.2
2024-11-27 09:37:25 +01:00
Ron
4fa9f446de Merge pull request #173 from cyberjunky/dependabot/pip/pre-commit-3.7.1
Bump pre-commit from 3.6.0 to 3.7.1
2024-11-27 09:37:11 +01:00
dependabot[bot]
3b54e25db5 Bump mypy from 1.8.0 to 1.10.1
Bumps [mypy](https://github.com/python/mypy) from 1.8.0 to 1.10.1.
- [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md)
- [Commits](https://github.com/python/mypy/compare/v1.8.0...v1.10.1)

---
updated-dependencies:
- dependency-name: mypy
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-01 19:10:08 +00:00
dependabot[bot]
73eb0cea73 Bump ruff from 0.3.5 to 0.5.0
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.3.5 to 0.5.0.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/v0.3.5...0.5.0)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-01 19:10:03 +00:00
dependabot[bot]
8099a99077 Bump pylint from 3.0.3 to 3.2.5
Bumps [pylint](https://github.com/pylint-dev/pylint) from 3.0.3 to 3.2.5.
- [Release notes](https://github.com/pylint-dev/pylint/releases)
- [Commits](https://github.com/pylint-dev/pylint/compare/v3.0.3...v3.2.5)

---
updated-dependencies:
- dependency-name: pylint
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-01 19:09:53 +00:00
dependabot[bot]
8647e95e30 Update pip requirement from <24.1,>=21.0 to >=24.1.1,<24.2
Updates the requirements on [pip](https://github.com/pypa/pip) to permit the latest version.
- [Changelog](https://github.com/pypa/pip/blob/main/NEWS.rst)
- [Commits](https://github.com/pypa/pip/compare/21.0...24.1.1)

---
updated-dependencies:
- dependency-name: pip
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-01 19:09:49 +00:00
dependabot[bot]
270327d7d8 Bump pre-commit from 3.6.0 to 3.7.1
Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.6.0 to 3.7.1.
- [Release notes](https://github.com/pre-commit/pre-commit/releases)
- [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md)
- [Commits](https://github.com/pre-commit/pre-commit/compare/v3.6.0...v3.7.1)

---
updated-dependencies:
- dependency-name: pre-commit
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-13 19:18:19 +00:00
kruemelro
14c6694239 changed value datatype to int 2024-04-08 08:57:53 +02:00
kruemelro
3d5200581d try and error ;-) 2024-04-05 10:17:20 +02:00
kruemelro
e4331ecf8c added missing entity_id 2024-04-05 10:05:43 +02:00
kruemelro
47096eabeb added blood_pressure function 2024-04-05 09:43:52 +02:00
kruemelro
09e80e4255 Update manifest.json 2024-04-03 08:04:11 +02:00
kruemelro
62377b5d55 changed body return values
instead of the total average, take the first measurement
2024-04-02 12:16:16 +02:00
kruemelro
9136466115 fixed typo 2024-04-02 11:49:48 +02:00
kruemelro
3bf77a9056 Update manifest.json 2024-04-02 11:40:38 +02:00
kruemelro
83ceb35666 Update garminconnect to 0.2.15 2024-04-02 11:26:08 +02:00
kruemelro
003a4c57ef changed get_body_composition
changed get_body_composition to load data of past week not only today
2024-04-02 11:24:46 +02:00
luk
261f41940f Add badges 2024-02-13 13:47:51 +01:00
10 changed files with 151 additions and 45 deletions

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2023 Ron Klinkien
Copyright (c) 2021-2024 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

View File

@@ -104,7 +104,6 @@ class GarminConnectDataUpdateCoordinator(DataUpdateCoordinator):
summary = {}
body = {}
activites = {}
alarms = {}
gear = {}
gear_stats = {}
@@ -112,6 +111,8 @@ class GarminConnectDataUpdateCoordinator(DataUpdateCoordinator):
activity_types = {}
sleep_data = {}
sleep_score = None
hrv_data = {}
hrvStatus = {"status": "UNKNOWN"}
try:
summary = await self.hass.async_add_executor_job(
@@ -130,6 +131,12 @@ class GarminConnectDataUpdateCoordinator(DataUpdateCoordinator):
_LOGGER.debug(f"Activities data: {activities}")
summary['lastActivities'] = activities
badges = await self.hass.async_add_executor_job(
self._api.get_earned_badges
)
_LOGGER.debug(f"Badges data: {badges}")
summary['badges'] = badges
alarms = await self.hass.async_add_executor_job(self._api.get_device_alarms)
_LOGGER.debug(f"Alarms data: {alarms}")
@@ -141,10 +148,14 @@ class GarminConnectDataUpdateCoordinator(DataUpdateCoordinator):
sleep_data = await self.hass.async_add_executor_job(
self._api.get_sleep_data, date.today().isoformat())
_LOGGER.debug(f"Sleep data: {sleep_data}")
hrv_data = await self.hass.async_add_executor_job(
self._api.get_hrv_data, date.today().isoformat())
_LOGGER.debug(f"hrv data: {hrv_data}")
except (
GarminConnectAuthenticationError,
GarminConnectTooManyRequestsError,
GarminConnectConnectionError,
GarminConnectConnectionError
) as error:
_LOGGER.debug("Trying to relogin to Garmin Connect")
if not await self.async_login():
@@ -179,6 +190,13 @@ class GarminConnectDataUpdateCoordinator(DataUpdateCoordinator):
except KeyError:
_LOGGER.debug("Sleep score data is not available")
try:
if "hrvSummary" in hrv_data:
hrvStatus = hrv_data["hrvSummary"]
_LOGGER.debug(f"HRV status: {hrvStatus} ")
except KeyError:
_LOGGER.debug("HRV data is not available")
return {
**summary,
**body["totalAverage"],
@@ -188,6 +206,7 @@ class GarminConnectDataUpdateCoordinator(DataUpdateCoordinator):
"activity_types": activity_types,
"gear_defaults": gear_defaults,
"sleepScore": sleep_score,
"hrvStatus": hrvStatus,
}
async def set_active_gear(self, entity, service_data):
@@ -257,3 +276,19 @@ class GarminConnectDataUpdateCoordinator(DataUpdateCoordinator):
service_data.data.get("visceral_fat_rating", None),
service_data.data.get("bmi", None)
)
async def add_blood_pressure(self, entity, service_data):
"""Record a blood pressure measurement"""
if not await self.async_login():
raise IntegrationError(
"Failed to login to Garmin Connect, unable to update"
)
await self.hass.async_add_executor_job(
self._api.set_blood_pressure,
service_data.data.get('systolic'),
service_data.data.get('diastolic'),
service_data.data.get('pulse'),
service_data.data.get('note', None)
)

View File

@@ -137,11 +137,11 @@ GARMIN_ENTITY_LIST = {
SensorStateClass.TOTAL,
True,
],
"minHeartRate": ["Min Heart Rate", "bpm", "mdi:heart-pulse", None, SensorStateClass.TOTAL, True],
"maxHeartRate": ["Max Heart Rate", "bpm", "mdi:heart-pulse", None, SensorStateClass.TOTAL, True],
"restingHeartRate": ["Resting Heart Rate", "bpm", "mdi:heart-pulse", None, SensorStateClass.TOTAL, True],
"minAvgHeartRate": ["Min Avg Heart Rate", "bpm", "mdi:heart-pulse", None, SensorStateClass.TOTAL, False],
"maxAvgHeartRate": ["Max Avg Heart Rate", "bpm", "mdi:heart-pulse", None, SensorStateClass.TOTAL, False],
"minHeartRate": ["Min Heart Rate", "bpm", "mdi:heart-pulse", None, SensorStateClass.MEASUREMENT, True],
"maxHeartRate": ["Max Heart Rate", "bpm", "mdi:heart-pulse", None, SensorStateClass.MEASUREMENT, True],
"restingHeartRate": ["Resting Heart Rate", "bpm", "mdi:heart-pulse", None, SensorStateClass.MEASUREMENT, True],
"minAvgHeartRate": ["Min Avg Heart Rate", "bpm", "mdi:heart-pulse", None, SensorStateClass.MEASUREMENT, False],
"maxAvgHeartRate": ["Max Avg Heart Rate", "bpm", "mdi:heart-pulse", None, SensorStateClass.MEASUREMENT, False],
"abnormalHeartRateAlertsCount": [
"Abnormal HR Counts",
None,
@@ -155,11 +155,11 @@ GARMIN_ENTITY_LIST = {
"bpm",
"mdi:heart-pulse",
None,
SensorStateClass.TOTAL,
SensorStateClass.MEASUREMENT,
False,
],
"averageStressLevel": ["Avg Stress Level", "lvl", "mdi:flash-alert", None, SensorStateClass.TOTAL, True],
"maxStressLevel": ["Max Stress Level", "lvl", "mdi:flash-alert", None, SensorStateClass.TOTAL, True],
"averageStressLevel": ["Avg Stress Level", "lvl", "mdi:flash-alert", None, SensorStateClass.MEASUREMENT, True],
"maxStressLevel": ["Max Stress Level", "lvl", "mdi:flash-alert", None, SensorStateClass.MEASUREMENT, True],
"stressQualifier": ["Stress Qualifier", None, "mdi:flash-alert", None, None, False],
"stressDuration": ["Stress Duration", UnitOfTime.MINUTES, "mdi:flash-alert", None, SensorStateClass.TOTAL, False],
"restStressDuration": [
@@ -223,7 +223,7 @@ GARMIN_ENTITY_LIST = {
PERCENTAGE,
"mdi:flash-alert",
None,
SensorStateClass.TOTAL,
SensorStateClass.MEASUREMENT,
False,
],
"restStressPercentage": [
@@ -231,7 +231,7 @@ GARMIN_ENTITY_LIST = {
PERCENTAGE,
"mdi:flash-alert",
None,
SensorStateClass.TOTAL,
SensorStateClass.MEASUREMENT,
False,
],
"activityStressPercentage": [
@@ -239,7 +239,7 @@ GARMIN_ENTITY_LIST = {
PERCENTAGE,
"mdi:flash-alert",
None,
SensorStateClass.TOTAL,
SensorStateClass.MEASUREMENT,
False,
],
"uncategorizedStressPercentage": [
@@ -247,7 +247,7 @@ GARMIN_ENTITY_LIST = {
PERCENTAGE,
"mdi:flash-alert",
None,
SensorStateClass.TOTAL,
SensorStateClass.MEASUREMENT,
False,
],
"lowStressPercentage": [
@@ -255,7 +255,7 @@ GARMIN_ENTITY_LIST = {
PERCENTAGE,
"mdi:flash-alert",
None,
SensorStateClass.TOTAL,
SensorStateClass.MEASUREMENT,
False,
],
"mediumStressPercentage": [
@@ -263,7 +263,7 @@ GARMIN_ENTITY_LIST = {
PERCENTAGE,
"mdi:flash-alert",
None,
SensorStateClass.TOTAL,
SensorStateClass.MEASUREMENT,
False,
],
"highStressPercentage": [
@@ -271,7 +271,7 @@ GARMIN_ENTITY_LIST = {
PERCENTAGE,
"mdi:flash-alert",
None,
SensorStateClass.TOTAL,
SensorStateClass.MEASUREMENT,
False,
],
"moderateIntensityMinutes": [
@@ -338,9 +338,9 @@ GARMIN_ENTITY_LIST = {
SensorStateClass.TOTAL,
True,
],
"averageSpo2": ["Average SPO2", PERCENTAGE, "mdi:diabetes", None, SensorStateClass.TOTAL, True],
"lowestSpo2": ["Lowest SPO2", PERCENTAGE, "mdi:diabetes", None, SensorStateClass.TOTAL, True],
"latestSpo2": ["Latest SPO2", PERCENTAGE, "mdi:diabetes", None, SensorStateClass.TOTAL, True],
"averageSpo2": ["Average SPO2", PERCENTAGE, "mdi:diabetes", None, SensorStateClass.MEASUREMENT, True],
"lowestSpo2": ["Lowest SPO2", PERCENTAGE, "mdi:diabetes", None, SensorStateClass.MEASUREMENT, True],
"latestSpo2": ["Latest SPO2", PERCENTAGE, "mdi:diabetes", None, SensorStateClass.MEASUREMENT, True],
"latestSpo2ReadingTimeLocal": [
"Latest SPO2 Time",
None,
@@ -362,7 +362,7 @@ GARMIN_ENTITY_LIST = {
"brpm",
"mdi:progress-clock",
None,
SensorStateClass.TOTAL,
SensorStateClass.MEASUREMENT,
False,
],
"lowestRespirationValue": [
@@ -370,7 +370,7 @@ GARMIN_ENTITY_LIST = {
"brpm",
"mdi:progress-clock",
None,
SensorStateClass.TOTAL,
SensorStateClass.MEASUREMENT,
False,
],
"latestRespirationValue": [
@@ -378,7 +378,7 @@ GARMIN_ENTITY_LIST = {
"brpm",
"mdi:progress-clock",
None,
SensorStateClass.TOTAL,
SensorStateClass.MEASUREMENT,
False,
],
"latestRespirationTimeGMT": [
@@ -390,16 +390,17 @@ GARMIN_ENTITY_LIST = {
False,
],
"weight": ["Weight", UnitOfMass.KILOGRAMS, "mdi:weight-kilogram", SensorDeviceClass.WEIGHT, SensorStateClass.MEASUREMENT, False],
"bmi": ["BMI", "bmi", "mdi:food", None, SensorStateClass.TOTAL, False],
"bodyFat": ["Body Fat", PERCENTAGE, "mdi:food", None, SensorStateClass.TOTAL, False],
"bodyWater": ["Body Water", PERCENTAGE, "mdi:water-percent", None, SensorStateClass.TOTAL, False],
"bmi": ["BMI", "bmi", "mdi:food", None, SensorStateClass.MEASUREMENT, False],
"bodyFat": ["Body Fat", PERCENTAGE, "mdi:food", None, SensorStateClass.MEASUREMENT, False],
"bodyWater": ["Body Water", PERCENTAGE, "mdi:water-percent", None, SensorStateClass.MEASUREMENT, False],
"boneMass": ["Bone Mass", UnitOfMass.KILOGRAMS, "mdi:bone", SensorDeviceClass.WEIGHT, SensorStateClass.MEASUREMENT, False],
"muscleMass": ["Muscle Mass", UnitOfMass.KILOGRAMS, "mdi:dumbbell", SensorDeviceClass.WEIGHT, SensorStateClass.MEASUREMENT, False],
"physiqueRating": ["Physique Rating", None, "mdi:numeric", None, SensorStateClass.TOTAL, False],
"visceralFat": ["Visceral Fat", PERCENTAGE, "mdi:food", None, SensorStateClass.TOTAL, False],
"metabolicAge": ["Metabolic Age", UnitOfTime.YEARS, "mdi:calendar-heart", None, SensorStateClass.TOTAL, False],
"physiqueRating": ["Physique Rating", None, "mdi:numeric", None, SensorStateClass.MEASUREMENT, False],
"visceralFat": ["Visceral Fat", PERCENTAGE, "mdi:food", None, SensorStateClass.MEASUREMENT, False],
"metabolicAge": ["Metabolic Age", UnitOfTime.YEARS, "mdi:calendar-heart", None, SensorStateClass.MEASUREMENT, False],
"nextAlarm": ["Next Alarm Time", None, "mdi:alarm", SensorDeviceClass.TIMESTAMP, None, True],
"lastActivities": ["Last Activities", None, "mdi:numeric", SensorStateClass.TOTAL, None, False],
"badges": ["Badges", None, "mdi:numeric", SensorStateClass.TOTAL, None, False],
"sleepScore": [
"Sleep Score",
None,
@@ -407,8 +408,15 @@ GARMIN_ENTITY_LIST = {
SensorStateClass.TOTAL,
SensorStateClass.MEASUREMENT,
True,
]
],
"hrvStatus": [
"HRV Status",
None,
"mdi:heart-pulse",
None,
None,
True,
],
}
GEAR_ICONS = {

View File

@@ -7,6 +7,6 @@
"documentation": "https://github.com/cyberjunky/home-assistant-garmin_connect",
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/cyberjunky/home-assistant-garmin_connect/issues",
"requirements": ["garminconnect>=0.2.22", "tzlocal"],
"version": "0.2.20"
"requirements": ["garminconnect>=0.2.24", "tzlocal"],
"version": "0.2.25"
}

View File

@@ -104,6 +104,10 @@ async def async_setup_entry(
"add_body_composition", BODY_COMPOSITION_SERVICE_SCHEMA, coordinator.add_body_composition
)
platform.async_register_entity_service(
"add_blood_pressure", BLOOD_PRESSURE_SERVICE_SCHEMA, coordinator.add_blood_pressure
)
ENTITY_SERVICE_SCHEMA = vol.Schema(
{
vol.Required(ATTR_ENTITY_ID): str,
@@ -131,6 +135,17 @@ BODY_COMPOSITION_SERVICE_SCHEMA = vol.Schema(
}
)
BLOOD_PRESSURE_SERVICE_SCHEMA = vol.Schema(
{
vol.Required(ATTR_ENTITY_ID): str,
vol.Required("systolic"): int,
vol.Required("diastolic"): int,
vol.Required("pulse"): int,
vol.Optional("note"): str
}
)
class GarminConnectSensor(CoordinatorEntity, SensorEntity):
"""Representation of a Garmin Connect Sensor."""
@@ -169,6 +184,12 @@ class GarminConnectSensor(CoordinatorEntity, SensorEntity):
if self._type == "lastActivities":
return len(self.coordinator.data[self._type])
if self._type == "badges":
return len(self.coordinator.data[self._type])
if self._type == "hrvStatus":
return self.coordinator.data[self._type]["status"]
if not self.coordinator.data or not self.coordinator.data[self._type]:
return None
@@ -212,11 +233,18 @@ class GarminConnectSensor(CoordinatorEntity, SensorEntity):
if self._type == "lastActivities":
attributes["last_Activities"] = self.coordinator.data[self._type]
if self._type == "badges":
attributes["badges"] = self.coordinator.data[self._type]
if self._type == "nextAlarm":
attributes["next_alarms"] = calculate_next_active_alarms(
self.coordinator.data[self._type]
)
if self._type == "hrvStatus":
attributes = {**attributes, **self.coordinator.data[self._type]}
del attributes["status"]
return attributes
@property
@@ -371,4 +399,4 @@ class GarminConnectGearSensor(CoordinatorEntity, SensorEntity):
lambda d: d[GEAR.UUID] == self.uuid and d["defaultGear"] is True,
self.coordinator.data["gear_defaults"],
)
)
)

View File

@@ -114,3 +114,36 @@ add_body_composition:
entity:
integration: garmin_connect
device_class: weight
add_blood_pressure:
name: Adds updated blood pressure metrics
description: Adds updated blood pressure metrics.
fields:
entity_id:
name: entity
description: entity
required: true
selector:
entity:
integration: garmin_connect
device_class: weight
systolic:
required: true
name: Systolic
description: Systolic value
example: 120
diastolic:
required: true
name: Diastolic
description: Diastolic value
example: 80
pulse:
required: true
name: Pulse
description: Pulse
example: 60
notes:
required: false
name: Notes
description: Add a note to the measurement
example: 'Measured with Beurer BC54'

View File

@@ -15,7 +15,7 @@
"password": "Heslo",
"username": "Užívateľské meno"
},
"description": "Zadajte svoje poverenia.",
"description": "Zadajte svoje poverovacie údaje.",
"title": "Garmin Connect"
}
}

View File

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

View File

@@ -1,8 +1,8 @@
colorlog==6.8.2
homeassistant==2024.1.0
pip>=21.0,<24.1
ruff==0.3.5
mypy==1.8.0
pre-commit==3.6.0
pylint==3.0.3
pip>=24.1.1,<24.2
ruff==0.8.3
mypy==1.13.0
pre-commit==4.0.1
pylint==3.3.2
types-cachetools

View File

@@ -1,3 +1,3 @@
-r requirements.txt
pre-commit==3.7.0
vulture==2.11
pre-commit==4.0.1
vulture==2.14