mirror of
https://github.com/cyberjunky/home-assistant-garmin_connect.git
synced 2026-01-09 12:57:58 -05:00
Compare commits
110 Commits
0.2.29
...
copilot/su
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
07c9e3ea86 | ||
|
|
62da8905c8 | ||
|
|
a34dd7abfc | ||
|
|
c73065a7b4 | ||
|
|
b1e8953393 | ||
|
|
a2aebe7790 | ||
|
|
2899837881 | ||
|
|
1776cb4037 | ||
|
|
f26e78de04 | ||
|
|
8d00693332 | ||
|
|
79dec62b81 | ||
|
|
037d7e70c5 | ||
|
|
cb1422c22b | ||
|
|
dc5151c641 | ||
|
|
1edb3c91b6 | ||
|
|
68a9cf3e10 | ||
|
|
26dd2143be | ||
|
|
17fc91d968 | ||
|
|
014b99a3b3 | ||
|
|
0f15469f58 | ||
|
|
925ab448ef | ||
|
|
8ae83a4ce0 | ||
|
|
425906d3e1 | ||
|
|
88e7d66345 | ||
|
|
a3e7261650 | ||
|
|
f90dfaaccc | ||
|
|
fd26ec0a29 | ||
|
|
c4892306f0 | ||
|
|
5d721ce9f0 | ||
|
|
bc0d248fbb | ||
|
|
bd2dcd075d | ||
|
|
a606d8bd74 | ||
|
|
8a37761560 | ||
|
|
b47c80ecc9 | ||
|
|
359eaea923 | ||
|
|
94e1416e5d | ||
|
|
0d0abbbc2d | ||
|
|
fb44c2cd1b | ||
|
|
0071642d77 | ||
|
|
42a56b73a3 | ||
|
|
65d1e99d88 | ||
|
|
fdcdc01b7b | ||
|
|
7b3a0bc970 | ||
|
|
9ed3f37762 | ||
|
|
5cf1038c35 | ||
|
|
d6dc1198e4 | ||
|
|
bca3360261 | ||
|
|
ca1acbc9f4 | ||
|
|
4c3cd3e8d3 | ||
|
|
799ad51305 | ||
|
|
0a7fb1b9fa | ||
|
|
dc5bf13660 | ||
|
|
9a83f6aca8 | ||
|
|
d0e7a15d35 | ||
|
|
509ee86bc1 | ||
|
|
a5632b4650 | ||
|
|
13e00af7a0 | ||
|
|
8ba2734c9f | ||
|
|
d0d519b738 | ||
|
|
c8592e9e43 | ||
|
|
57ffa3f47b | ||
|
|
4edc2993bf | ||
|
|
015110f5e6 | ||
|
|
d25506e3d2 | ||
|
|
6c0f7eba64 | ||
|
|
21204bed29 | ||
|
|
9cf1b3a3bb | ||
|
|
84ad53891b | ||
|
|
4163be285f | ||
|
|
ee5df999a0 | ||
|
|
a179131a94 | ||
|
|
9d57849ced | ||
|
|
4a9901958e | ||
|
|
7c119b9fe5 | ||
|
|
89ea628936 | ||
|
|
8e0a27d9b7 | ||
|
|
83840b8829 | ||
|
|
b41cf2c007 | ||
|
|
01981a0e9b | ||
|
|
107c0af24f | ||
|
|
401d2e6b59 | ||
|
|
0e22122c00 | ||
|
|
6cb7e46d0e | ||
|
|
c357da5a81 | ||
|
|
680d95bddc | ||
|
|
36bbd2f891 | ||
|
|
68246a587e | ||
|
|
704eb68fbc | ||
|
|
7a217ab183 | ||
|
|
7b2f4ac570 | ||
|
|
adda8c1afb | ||
|
|
627f99f702 | ||
|
|
83e8e52d72 | ||
|
|
c94104443d | ||
|
|
13b2bb64b0 | ||
|
|
d9b99cd9ea | ||
|
|
00a15e077a | ||
|
|
4a5564bc45 | ||
|
|
b35de63aae | ||
|
|
c52166ded0 | ||
|
|
d6bc6f7f69 | ||
|
|
a41b847e45 | ||
|
|
9c42b634e7 | ||
|
|
2f19c5b1d6 | ||
|
|
28a95b2ab2 | ||
|
|
d1609b5c5b | ||
|
|
6b5d8fc0b6 | ||
|
|
be907979ba | ||
|
|
d884162c8f | ||
|
|
194f377016 |
22
.coderabbit.yaml
Normal file
22
.coderabbit.yaml
Normal file
@@ -0,0 +1,22 @@
|
||||
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json # Schema for CodeRabbit configurations
|
||||
language: "en-US"
|
||||
early_access: true
|
||||
reviews:
|
||||
profile: "assertive"
|
||||
request_changes_workflow: false
|
||||
high_level_summary: true
|
||||
poem: false
|
||||
review_status: true
|
||||
collapse_walkthrough: false
|
||||
auto_review:
|
||||
enabled: true
|
||||
drafts: false
|
||||
path_filters:
|
||||
- "!tests/**/cassettes/**"
|
||||
path_instructions:
|
||||
- path: "tests/**"
|
||||
instructions: |
|
||||
- test functions shouldn't have a return type hint
|
||||
- it's ok to use `assert` instead of `pytest.assume()`
|
||||
chat:
|
||||
auto_reply: true
|
||||
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- OS: [e.g. iOS]
|
||||
- Browser [e.g. chrome, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Smartphone (please complete the following information):**
|
||||
- Device: [e.g. iPhone6]
|
||||
- OS: [e.g. iOS8.1]
|
||||
- Browser [e.g. stock browser, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
2
.github/workflows/hassfest.yaml
vendored
2
.github/workflows/hassfest.yaml
vendored
@@ -10,5 +10,5 @@ jobs:
|
||||
validate:
|
||||
runs-on: "ubuntu-latest"
|
||||
steps:
|
||||
- uses: "actions/checkout@v4"
|
||||
- uses: "actions/checkout@v5"
|
||||
- uses: home-assistant/actions/hassfest@master
|
||||
|
||||
124
README.md
124
README.md
@@ -1,41 +1,42 @@
|
||||
[](https://github.com/hacs/integration) [](https://www.python.org/) [](https://www.paypal.me/cyberjunkynl/)
|
||||
[](https://www.paypal.me/cyberjunkynl/)
|
||||
[](https://github.com/sponsors/cyberjunky)
|
||||
|
||||
# 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 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.
|
||||
## Install via HACS
|
||||
|
||||
## Installation
|
||||
- The installation is done inside [HACS](https://hacs.xyz/) (Home Assistant Community Store).
|
||||
- If you already have HACS installed click on the MyHomeAssistant button below, otherwise install HACS before adding this integration.
|
||||
You can find installation instructions [here.](https://hacs.xyz/docs/setup/download)
|
||||
- Once HACS is installed, search for `garmin connect` and click on "Download". Once downloaded, restart HomeAssistant.
|
||||
|
||||
### HACS - Recommended
|
||||
- Have [HACS](https://hacs.xyz) installed, this will allow you to easily manage and track updates.
|
||||
- Inside HACS click 'Explore & download repositories'
|
||||
- Search for 'Garmin Connect'.
|
||||
- Click on found integration.
|
||||
- Click Download this repository with HACS.
|
||||
- Restart Home-Assistant.
|
||||
- Follow configuration steps below.
|
||||
## 📦 Installation
|
||||
|
||||
### Manual
|
||||
- Copy directory `custom_components/garmin_connect` to your `<config dir>/custom_components` directory.
|
||||
- Restart Home-Assistant.
|
||||
- Follow configuration steps below.
|
||||
[](https://my.home-assistant.io/redirect/hacs_repository/?owner=cyberjunky&repository=home-assistant-garmin_connect&category=integration)
|
||||
|
||||
## Configuration
|
||||
|
||||
Adding Garmin Connect to your Home Assistant instance can be done via the integrations user interface.
|
||||
- In the sidebar, click 'Configuration', then 'Devices & Services'. Click the + icon to add "Garmin Connect" to your Home Assistant installation.
|
||||
- Enter the credentials of the Garmin Connect account you want to add.
|
||||
- Optionally -when MFA is enabled- it will ask for your MFA code.
|
||||
|
||||
- Browse to your Home Assistant instance.
|
||||
- In the sidebar click on Configuration.
|
||||
- From the configuration menu select: Integrations.
|
||||
- In the bottom right, click on the Add Integration button.
|
||||
- From the list, search and select “Garmin Connect”.
|
||||
- Follow the instruction on screen to complete the set up
|
||||
After successful set up a standard set of sensors are enabled. You can enable more if needed by using the Entities page under Devices and services. (Filter on disabled state)
|
||||
|
||||
After successful set up a standard set of sensors are enabled. You can enable more if needed by using the Integrations page.
|
||||
The integration will fetch new data every 5 minutes, make sure your devices sync to the Garmin Connect website.
|
||||
|
||||
Please be aware that Garmin Connect has very low rate limits, max. once every ~5 minutes.
|
||||
### Reload Without Restart
|
||||
|
||||
This integration supports **reloading without restarting Home Assistant**:
|
||||
- Go to **Settings** → **Devices & Services** → **Garmin Connect**
|
||||
- Click the **three dots (⋮)** → **Reload**
|
||||
|
||||
This is useful after:
|
||||
- Updating the integration via HACS
|
||||
- Changing configuration options
|
||||
- Troubleshooting issues
|
||||
|
||||
No need to restart your entire Home Assistant instance!
|
||||
|
||||
## Available Sensors
|
||||
|
||||
@@ -84,6 +85,15 @@ Next Alarm Time
|
||||
Total Sleep Duration
|
||||
HRV Status
|
||||
Gear Sensors
|
||||
Chronological Age
|
||||
Fitness Age
|
||||
Achievable Fitness Age
|
||||
Previous Fitness Age
|
||||
Hydration
|
||||
Hydration Goal
|
||||
Hydration Daily Average
|
||||
Hydration Sweat Loss
|
||||
Hydration Activity Intake
|
||||
```
|
||||
|
||||
Disabled by default:
|
||||
@@ -138,6 +148,7 @@ Visceral Fat
|
||||
Metabolic Age
|
||||
Last Activities
|
||||
Last Activity
|
||||
Endurance Score
|
||||
```
|
||||
|
||||
## Screenshots
|
||||
@@ -178,7 +189,7 @@ action:
|
||||
mode: single
|
||||
```
|
||||
|
||||
### Examples on how to test services from HA GUI
|
||||
### Examples on how to test actions from HA GUI
|
||||
|
||||
#### Add Body Composition
|
||||
|
||||
@@ -189,10 +200,42 @@ data:
|
||||
weight: 87
|
||||
bmi: 25.5
|
||||
bone_mass: 4.8
|
||||
...
|
||||
```
|
||||
See the action template for other available values to add
|
||||
|
||||
NOTE: You need to enable Weight entity
|
||||
NOTE: You need to enable the Weight entity
|
||||
|
||||
Full example:
|
||||
```
|
||||
alias: WithingsToGarmin
|
||||
description: ""
|
||||
triggers:
|
||||
- trigger: state
|
||||
entity_id:
|
||||
- sensor.withings_poids
|
||||
conditions:
|
||||
- condition: numeric_state
|
||||
entity_id: sensor.withings_poids
|
||||
above: 55
|
||||
below: 80
|
||||
actions:
|
||||
- action: garmin_connect.add_body_composition
|
||||
metadata: {}
|
||||
data:
|
||||
entity_id: sensor.weight
|
||||
weight: "{{states('sensor.withings_poids')}}"
|
||||
timestamp: "{{ as_timestamp(now()) | timestamp_local}}"
|
||||
bmi: >-
|
||||
{{ (states('sensor.withings_poids') | float(0) / 1.72**2 )| round(1,
|
||||
default=0) }}
|
||||
bone_mass: "{{states('sensor.withings_bone_mass')}}"
|
||||
muscle_mass: "{{states('sensor.withings_masse_musculaire')}}"
|
||||
percent_hydration: >-
|
||||
{{ (float(states('sensor.withings_hydration')) /
|
||||
float(states('sensor.withings_poids')) * 100 ) | round(2, default=0) }}
|
||||
percent_fat: "{{states('sensor.withings_taux_de_graisse')}}"
|
||||
mode: single
|
||||
```
|
||||
|
||||
#### Set Active Gear
|
||||
|
||||
@@ -228,5 +271,26 @@ logger:
|
||||
custom_components.garmin_connect: debug
|
||||
```
|
||||
|
||||
## Donation
|
||||
[](https://www.paypal.me/cyberjunkynl/)
|
||||
## 💖 Support This Project
|
||||
|
||||
If you find this library useful for your projects, please consider supporting its continued development and maintenance:
|
||||
|
||||
### 🌟 Ways to Support
|
||||
|
||||
- **⭐ Star this repository** - Help others discover the project
|
||||
- **💰 Financial Support** - Contribute to development and hosting costs
|
||||
- **🐛 Report Issues** - Help improve stability and compatibility
|
||||
- **📖 Spread the Word** - Share with other developers
|
||||
|
||||
### 💳 Financial Support Options
|
||||
|
||||
[](https://www.paypal.me/cyberjunkynl/)
|
||||
[](https://github.com/sponsors/cyberjunky)
|
||||
|
||||
**Why Support?**
|
||||
- Keeps the project actively maintained
|
||||
- Enables faster bug fixes and new features
|
||||
- Supports infrastructure costs (testing, AI, CI/CD)
|
||||
- Shows appreciation for hundreds of hours of development
|
||||
|
||||
Every contribution, no matter the size, makes a difference and is greatly appreciated! 🙏
|
||||
|
||||
112
SENSOR_GROUPS.md
Normal file
112
SENSOR_GROUPS.md
Normal file
@@ -0,0 +1,112 @@
|
||||
# Sensor Groups Feature
|
||||
|
||||
## Overview
|
||||
|
||||
The Garmin Connect integration now supports organizing sensors into logical groups that can be enabled or disabled together. This helps reduce clutter in your Home Assistant instance by only showing the sensors you actually use.
|
||||
|
||||
## Available Sensor Groups
|
||||
|
||||
### Enabled by Default
|
||||
|
||||
- **Activity & Steps**: Step counts, distance, floors climbed, and daily goals
|
||||
- **Calories & Nutrition**: Calorie tracking including active, burned, consumed, and remaining
|
||||
- **Heart Rate**: Heart rate monitoring including resting, min/max, and HRV status
|
||||
- **Stress**: Stress levels and duration tracking
|
||||
- **Sleep**: Sleep duration, quality scores, and sleep stages
|
||||
- **Body Battery**: Garmin Body Battery energy monitoring
|
||||
- **Hydration**: Water intake tracking and hydration goals
|
||||
- **Intensity & Activity Time**: Active time, sedentary time, and intensity minutes
|
||||
- **Health Monitoring**: SpO2 (blood oxygen), respiration rate, and altitude
|
||||
- **Fitness & Performance**: Fitness age, endurance score, and metabolic age
|
||||
|
||||
### Disabled by Default
|
||||
|
||||
- **Body Composition**: Weight, BMI, body fat, muscle mass, and bone mass (requires compatible scale)
|
||||
- **Activity Tracking**: Recent activities, badges, points, and gamification
|
||||
- **Advanced Sensors**: Additional detailed metrics and alternative measurements
|
||||
|
||||
## How to Configure
|
||||
|
||||
### Initial Setup
|
||||
|
||||
When you first install the integration, all default sensor groups are enabled automatically. This ensures backward compatibility with previous versions.
|
||||
|
||||
### Changing Sensor Groups
|
||||
|
||||
1. Go to **Settings** → **Devices & Services**
|
||||
2. Find the **Garmin Connect** integration
|
||||
3. Click **Configure** (or the three dots menu → **Configure**)
|
||||
4. Select which sensor groups you want to enable
|
||||
5. Click **Submit**
|
||||
6. **Reload the integration** for changes to take effect
|
||||
|
||||
### Per-Sensor Control
|
||||
|
||||
Even within enabled sensor groups, you can still disable individual sensors:
|
||||
|
||||
1. Go to **Settings** → **Devices & Services**
|
||||
2. Find the **Garmin Connect** integration
|
||||
3. Click on the device
|
||||
4. Find the sensor you want to disable
|
||||
5. Click on it and toggle **Enable entity** off
|
||||
|
||||
## Backward Compatibility
|
||||
|
||||
- **Existing installations**: If you upgrade from a previous version, all default sensor groups will be automatically enabled, maintaining your current setup
|
||||
- **Configuration-less**: If you never configure sensor groups, all default groups remain enabled
|
||||
- **Individual control**: The `entity_registry_enabled_default` setting on individual sensors still works within enabled groups
|
||||
|
||||
## Benefits
|
||||
|
||||
1. **Reduced Clutter**: Only see sensors relevant to your use case
|
||||
2. **Performance**: Fewer entities to process in Home Assistant
|
||||
3. **Organization**: Sensors are logically grouped for easier management
|
||||
4. **Flexibility**: Enable/disable entire categories or individual sensors
|
||||
5. **Scalability**: Easy to add new sensor categories in the future
|
||||
|
||||
## Examples
|
||||
|
||||
### Minimal Setup (Basic Activity Tracking)
|
||||
Enable only:
|
||||
- Activity & Steps
|
||||
- Heart Rate
|
||||
- Sleep
|
||||
|
||||
### Comprehensive Health Monitoring
|
||||
Enable:
|
||||
- All default groups
|
||||
- Body Composition (if you have a compatible scale)
|
||||
- Advanced Sensors (for detailed analysis)
|
||||
|
||||
### Athlete/Training Focus
|
||||
Enable:
|
||||
- Activity & Steps
|
||||
- Heart Rate
|
||||
- Stress
|
||||
- Body Battery
|
||||
- Intensity & Activity Time
|
||||
- Fitness & Performance
|
||||
|
||||
## Technical Details
|
||||
|
||||
### Storage
|
||||
|
||||
Sensor group preferences are stored in the integration's options, separate from the main configuration. This allows:
|
||||
- Easy reconfiguration without re-authentication
|
||||
- No impact on existing authentication tokens
|
||||
- Clean separation of concerns
|
||||
|
||||
### Implementation
|
||||
|
||||
- Sensor descriptions are organized into tuples by category
|
||||
- A mapping dictionary links group IDs to sensor tuples
|
||||
- The `get_sensors_for_groups()` function dynamically builds the sensor list
|
||||
- Backward compatibility is ensured by checking for `None` options
|
||||
|
||||
## Future Enhancements
|
||||
|
||||
Potential future additions:
|
||||
- Export/import sensor group configurations
|
||||
- Preset configurations for different use cases
|
||||
- Dynamic group enabling based on detected Garmin device capabilities
|
||||
- Statistics about which groups are most commonly enabled
|
||||
@@ -13,10 +13,11 @@ from garminconnect import (
|
||||
GarminConnectTooManyRequestsError,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.const import CONF_ID, CONF_PASSWORD, CONF_TOKEN, CONF_USERNAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||
import requests
|
||||
|
||||
from .const import (
|
||||
DATA_COORDINATOR,
|
||||
@@ -32,6 +33,105 @@ _LOGGER = logging.getLogger(__name__)
|
||||
PLATFORMS = ["sensor"]
|
||||
|
||||
|
||||
async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Migrate old config entry from username/password to token-based authentication."""
|
||||
_LOGGER.debug(
|
||||
"Migrating Garmin Connect config entry from version %s", entry.version)
|
||||
|
||||
if entry.version == 1:
|
||||
# Scenario 1: Has USERNAME + PASSWORD but no TOKEN (old auth method)
|
||||
# Migrate to: ID + TOKEN
|
||||
if (
|
||||
CONF_TOKEN not in entry.data
|
||||
and CONF_USERNAME in entry.data
|
||||
and CONF_PASSWORD in entry.data
|
||||
):
|
||||
_LOGGER.info(
|
||||
"Migrating Garmin Connect config entry from username/password to token-based authentication")
|
||||
|
||||
username = entry.data[CONF_USERNAME]
|
||||
password = entry.data[CONF_PASSWORD]
|
||||
|
||||
# Determine if user is in China
|
||||
in_china = hass.config.country == "CN"
|
||||
|
||||
# Create temporary API client to get token
|
||||
api = Garmin(email=username, password=password, is_cn=in_china)
|
||||
|
||||
try:
|
||||
# Login to get the token
|
||||
await hass.async_add_executor_job(api.login)
|
||||
|
||||
# Get the OAuth tokens
|
||||
tokens = api.garth.dumps()
|
||||
|
||||
# Create new data with token, keeping the ID
|
||||
new_data = {
|
||||
CONF_ID: entry.data.get(CONF_ID, username),
|
||||
CONF_TOKEN: tokens,
|
||||
}
|
||||
|
||||
# Update the config entry
|
||||
hass.config_entries.async_update_entry(entry, data=new_data)
|
||||
|
||||
_LOGGER.info(
|
||||
"Successfully migrated Garmin Connect config entry")
|
||||
return True
|
||||
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
_LOGGER.error(
|
||||
"Failed to migrate Garmin Connect config entry. "
|
||||
"Please re-add the integration. Error: %s",
|
||||
err,
|
||||
)
|
||||
return False
|
||||
|
||||
# Scenario 2: Has USERNAME + TOKEN but no ID (partially migrated)
|
||||
# Migrate to: ID + TOKEN (remove USERNAME)
|
||||
elif (
|
||||
CONF_ID not in entry.data
|
||||
and CONF_USERNAME in entry.data
|
||||
and CONF_TOKEN in entry.data
|
||||
):
|
||||
_LOGGER.info(
|
||||
"Migrating Garmin Connect config entry: converting USERNAME to ID")
|
||||
|
||||
username = entry.data[CONF_USERNAME]
|
||||
|
||||
# Create new data with ID instead of USERNAME
|
||||
new_data = {
|
||||
CONF_ID: username,
|
||||
CONF_TOKEN: entry.data[CONF_TOKEN],
|
||||
}
|
||||
|
||||
# Update the config entry
|
||||
hass.config_entries.async_update_entry(entry, data=new_data)
|
||||
|
||||
_LOGGER.info(
|
||||
"Successfully migrated Garmin Connect config entry from USERNAME to ID")
|
||||
return True
|
||||
|
||||
# Scenario 3: Missing both TOKEN and credentials (incomplete/corrupted)
|
||||
# Add placeholder ID to allow reauth flow
|
||||
elif CONF_TOKEN not in entry.data:
|
||||
if CONF_ID not in entry.data:
|
||||
_LOGGER.info(
|
||||
"Config entry missing CONF_ID, adding placeholder for reauth flow")
|
||||
new_data = {
|
||||
**entry.data,
|
||||
CONF_ID: entry.entry_id, # Use entry_id as fallback
|
||||
}
|
||||
hass.config_entries.async_update_entry(entry, data=new_data)
|
||||
|
||||
_LOGGER.info(
|
||||
"Garmin Connect config entry is incomplete (missing token). "
|
||||
"Reauthentication will be required to complete setup."
|
||||
)
|
||||
return True
|
||||
|
||||
return True
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Set up Garmin Connect from a config entry."""
|
||||
|
||||
@@ -47,9 +147,17 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
|
||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||
|
||||
# Register update listener to reload integration when options change
|
||||
entry.async_on_unload(entry.add_update_listener(async_reload_entry))
|
||||
|
||||
return True
|
||||
|
||||
|
||||
async def async_reload_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
||||
"""Reload the config entry when options change."""
|
||||
await hass.config_entries.async_reload(entry.entry_id)
|
||||
|
||||
|
||||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||
"""Unload a config entry."""
|
||||
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||
@@ -58,48 +166,105 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||
return unload_ok
|
||||
|
||||
|
||||
async def async_reload_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
||||
"""Reload config entry."""
|
||||
await async_unload_entry(hass, entry)
|
||||
await async_setup_entry(hass, entry)
|
||||
|
||||
|
||||
class GarminConnectDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
"""Garmin Connect Data Update Coordinator."""
|
||||
|
||||
def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None:
|
||||
"""Initialize the Garmin Connect hub."""
|
||||
"""
|
||||
Initialize the Garmin Connect data update coordinator for Home Assistant.
|
||||
|
||||
Configures the Garmin API client, determines if the user is located in China, sets the time zone, and establishes the data update interval for the integration.
|
||||
"""
|
||||
self.entry = entry
|
||||
self.hass = hass
|
||||
self.in_china = False
|
||||
self._in_china = False
|
||||
|
||||
self.country = self.hass.config.country
|
||||
if self.country == "CN":
|
||||
self.in_china = True
|
||||
_LOGGER.debug("Country: %s", self.country)
|
||||
# Check if the user resides in China
|
||||
country = self.hass.config.country
|
||||
if country == "CN":
|
||||
self._in_china = True
|
||||
_LOGGER.debug("Country: %s", country)
|
||||
|
||||
self.time_zone = self.hass.config.time_zone
|
||||
_LOGGER.debug("Time zone: %s", self.time_zone)
|
||||
|
||||
self.api = Garmin(entry.data[CONF_USERNAME], entry.data[CONF_PASSWORD], self.in_china)
|
||||
self.api = Garmin(is_cn=self._in_china)
|
||||
|
||||
super().__init__(hass, _LOGGER, name=DOMAIN, update_interval=DEFAULT_UPDATE_INTERVAL)
|
||||
super().__init__(hass, _LOGGER, name=DOMAIN,
|
||||
update_interval=DEFAULT_UPDATE_INTERVAL)
|
||||
|
||||
async def async_login(self) -> bool:
|
||||
"""Login to Garmin Connect."""
|
||||
"""
|
||||
Asynchronously authenticates with Garmin Connect using a stored token.
|
||||
|
||||
Attempts to log in with the token from the configuration entry, handling authentication failures, rate limiting, connection errors, and missing tokens by raising Home Assistant exceptions or returning False for recoverable errors.
|
||||
|
||||
Returns:
|
||||
bool: True if login succeeds; False if rate limited or an unknown error occurs.
|
||||
|
||||
Raises:
|
||||
ConfigEntryAuthFailed: If authentication fails or the token is missing.
|
||||
ConfigEntryNotReady: If a connection error occurs.
|
||||
"""
|
||||
try:
|
||||
await self.hass.async_add_executor_job(self.api.login)
|
||||
except (
|
||||
GarminConnectAuthenticationError,
|
||||
GarminConnectTooManyRequestsError,
|
||||
) as err:
|
||||
_LOGGER.error("Error occurred during Garmin Connect login request: %s", err)
|
||||
# Check if the token exists in the entry data
|
||||
if CONF_TOKEN not in self.entry.data:
|
||||
_LOGGER.info(
|
||||
"Token not found in config entry. Reauthentication required."
|
||||
)
|
||||
raise ConfigEntryAuthFailed(
|
||||
"Token not found in config entry. Please reauthenticate."
|
||||
)
|
||||
|
||||
await self.hass.async_add_executor_job(self.api.login, self.entry.data[CONF_TOKEN])
|
||||
except ConfigEntryAuthFailed:
|
||||
# Re-raise ConfigEntryAuthFailed without catching it in the generic handler
|
||||
raise
|
||||
except GarminConnectAuthenticationError as err:
|
||||
_LOGGER.error(
|
||||
"Authentication error occurred during login: %s", err.response.text)
|
||||
raise ConfigEntryAuthFailed from err
|
||||
except GarminConnectTooManyRequestsError as err:
|
||||
_LOGGER.error(
|
||||
"Too many request error occurred during login: %s", err)
|
||||
return False
|
||||
except GarminConnectConnectionError as err:
|
||||
_LOGGER.error("Connection error occurred during Garmin Connect login request: %s", err)
|
||||
_LOGGER.error(
|
||||
"Connection error occurred during Garmin Connect login request: %s", err)
|
||||
raise ConfigEntryNotReady from err
|
||||
except Exception: # pylint: disable=broad-except
|
||||
_LOGGER.exception("Unknown error occurred during Garmin Connect login request")
|
||||
except requests.exceptions.HTTPError as err:
|
||||
if err.response.status_code == 401:
|
||||
_LOGGER.error(
|
||||
"Authentication error occurred during login: %s", err.response.text)
|
||||
raise ConfigEntryAuthFailed from err
|
||||
if err.response.status_code == 429:
|
||||
_LOGGER.error(
|
||||
"Too many requests error occurred during login: %s", err.response.text
|
||||
)
|
||||
return False
|
||||
_LOGGER.error("Unknown HTTP error occurred during login: %s", err)
|
||||
return False
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
_LOGGER.exception("Unknown error occurred during login: %s", err)
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
async def _async_update_data(self) -> dict:
|
||||
"""Fetch data from Garmin Connect."""
|
||||
"""
|
||||
Fetches and aggregates comprehensive user data from Garmin Connect for the current day.
|
||||
|
||||
This asynchronous method retrieves and consolidates user summary, body composition, recent activities, badges, alarms, activity types, sleep metrics, HRV data, fitness age, hydration, and gear information. It calculates user points and level, determines the next scheduled alarms, and extracts key sleep and HRV metrics. Handles authentication, connection, and rate limiting errors by raising Home Assistant exceptions or returning empty results as appropriate.
|
||||
|
||||
Returns:
|
||||
dict: A dictionary containing consolidated Garmin Connect data, including user summary, body composition, activities, badges, alarms, activity types, sleep metrics, HRV status, fitness age, hydration, gear details, user points, user level, next alarms, sleep score, and sleep time.
|
||||
"""
|
||||
summary = {}
|
||||
body = {}
|
||||
alarms = {}
|
||||
@@ -113,6 +278,8 @@ class GarminConnectDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
sleep_time_seconds = None
|
||||
hrv_data = {}
|
||||
hrv_status = {"status": "unknown"}
|
||||
endurance_data = {}
|
||||
endurance_status = {"overallScore": None}
|
||||
next_alarms = []
|
||||
|
||||
today = datetime.now(ZoneInfo(self.time_zone)).date()
|
||||
@@ -122,13 +289,19 @@ class GarminConnectDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
summary = await self.hass.async_add_executor_job(
|
||||
self.api.get_user_summary, today.isoformat()
|
||||
)
|
||||
_LOGGER.debug("Summary data fetched: %s", summary)
|
||||
if summary:
|
||||
_LOGGER.debug("User summary data fetched: %s", summary)
|
||||
else:
|
||||
_LOGGER.debug("No user summary data found")
|
||||
|
||||
# Body composition
|
||||
body = await self.hass.async_add_executor_job(
|
||||
self.api.get_body_composition, today.isoformat()
|
||||
)
|
||||
_LOGGER.debug("Body data fetched: %s", body)
|
||||
if body:
|
||||
_LOGGER.debug("Body data fetched: %s", body)
|
||||
else:
|
||||
_LOGGER.debug("No body data found")
|
||||
|
||||
# Last activities
|
||||
last_activities = await self.hass.async_add_executor_job(
|
||||
@@ -136,20 +309,33 @@ class GarminConnectDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
(today - timedelta(days=7)).isoformat(),
|
||||
(today + timedelta(days=1)).isoformat(),
|
||||
)
|
||||
_LOGGER.debug("Activities data fetched: %s", last_activities)
|
||||
if last_activities:
|
||||
_LOGGER.debug("Last activities data fetched: %s",
|
||||
last_activities)
|
||||
else:
|
||||
_LOGGER.debug("No last activities data found")
|
||||
|
||||
# Add last activities to summary
|
||||
summary["lastActivities"] = last_activities
|
||||
summary["lastActivity"] = last_activities[0] if last_activities else {}
|
||||
|
||||
# Badges
|
||||
badges = await self.hass.async_add_executor_job(self.api.get_earned_badges)
|
||||
_LOGGER.debug("Badges data fetched: %s", badges)
|
||||
if badges:
|
||||
_LOGGER.debug("Badges data fetched: %s", badges)
|
||||
else:
|
||||
_LOGGER.debug("No badges data found")
|
||||
|
||||
# Add badges to summary
|
||||
summary["badges"] = badges
|
||||
|
||||
# Calculate user points and user level
|
||||
user_points = 0
|
||||
for badge in badges:
|
||||
user_points += badge["badgePoints"] * badge["badgeEarnedNumber"]
|
||||
user_points += badge["badgePoints"] * \
|
||||
badge["badgeEarnedNumber"]
|
||||
|
||||
# Add user points to summary
|
||||
summary["userPoints"] = user_points
|
||||
|
||||
user_level = 0
|
||||
@@ -157,29 +343,48 @@ class GarminConnectDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
if user_points >= points:
|
||||
user_level = level
|
||||
|
||||
# Add user level to summary
|
||||
summary["userLevel"] = user_level
|
||||
|
||||
# Alarms
|
||||
alarms = await self.hass.async_add_executor_job(self.api.get_device_alarms)
|
||||
_LOGGER.debug("Alarms data fetched: %s", alarms)
|
||||
if alarms:
|
||||
_LOGGER.debug("Alarms data fetched: %s", alarms)
|
||||
else:
|
||||
_LOGGER.debug("No alarms data found")
|
||||
|
||||
# Add alarms to summary
|
||||
next_alarms = calculate_next_active_alarms(alarms, self.time_zone)
|
||||
|
||||
# Activity types
|
||||
activity_types = await self.hass.async_add_executor_job(self.api.get_activity_types)
|
||||
_LOGGER.debug("Activity types data fetched: %s", activity_types)
|
||||
if activity_types:
|
||||
_LOGGER.debug("Activity types data fetched: %s",
|
||||
activity_types)
|
||||
else:
|
||||
_LOGGER.debug("No activity types data found")
|
||||
|
||||
# Sleep data
|
||||
sleep_data = await self.hass.async_add_executor_job(
|
||||
self.api.get_sleep_data, today.isoformat()
|
||||
)
|
||||
_LOGGER.debug("Sleep data fetched: %s", sleep_data)
|
||||
if sleep_data:
|
||||
_LOGGER.debug("Sleep data fetched: %s", sleep_data)
|
||||
else:
|
||||
_LOGGER.debug("No sleep data found")
|
||||
|
||||
# HRV data
|
||||
hrv_data = await self.hass.async_add_executor_job(
|
||||
self.api.get_hrv_data, today.isoformat()
|
||||
)
|
||||
_LOGGER.debug("HRV data fetched: %s", hrv_data)
|
||||
|
||||
# Endurance data
|
||||
endurance_data = await self.hass.async_add_executor_job(
|
||||
self.api.get_endurance_score, today.isoformat()
|
||||
)
|
||||
_LOGGER.debug("Endurance data fetched: %s", endurance_data)
|
||||
|
||||
except (
|
||||
GarminConnectAuthenticationError,
|
||||
GarminConnectTooManyRequestsError,
|
||||
@@ -191,46 +396,155 @@ class GarminConnectDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
|
||||
# Gear data
|
||||
try:
|
||||
gear = await self.hass.async_add_executor_job(
|
||||
self.api.get_gear, summary[Gear.USERPROFILE_ID]
|
||||
)
|
||||
_LOGGER.debug("Gear data fetched: %s", gear)
|
||||
# Check if userProfileId exists in summary before fetching gear data
|
||||
if Gear.USERPROFILE_ID in summary:
|
||||
gear = await self.hass.async_add_executor_job(
|
||||
self.api.get_gear, summary[Gear.USERPROFILE_ID]
|
||||
)
|
||||
_LOGGER.debug("Gear data fetched: %s", gear)
|
||||
else:
|
||||
_LOGGER.debug("No userProfileId found in summary, skipping gear data fetch")
|
||||
|
||||
tasks: list[Awaitable] = [
|
||||
self.hass.async_add_executor_job(self.api.get_gear_stats, gear_item[Gear.UUID])
|
||||
for gear_item in gear
|
||||
]
|
||||
gear_stats = await asyncio.gather(*tasks)
|
||||
_LOGGER.debug("Gear stats data fetched: %s", gear_stats)
|
||||
|
||||
gear_defaults = await self.hass.async_add_executor_job(
|
||||
self.api.get_gear_defaults, summary[Gear.USERPROFILE_ID]
|
||||
# Fitness age data
|
||||
fitnessage_data = await self.hass.async_add_executor_job(
|
||||
self.api.get_fitnessage_data, today.isoformat()
|
||||
)
|
||||
_LOGGER.debug("Gear defaults data fetched: %s", gear_defaults)
|
||||
if fitnessage_data:
|
||||
_LOGGER.debug("Fitness age data fetched: %s", fitnessage_data)
|
||||
else:
|
||||
_LOGGER.debug("No fitness age data found")
|
||||
|
||||
# Hyrdation data
|
||||
hydration_data = await self.hass.async_add_executor_job(
|
||||
self.api.get_hydration_data, today.isoformat()
|
||||
)
|
||||
if hydration_data:
|
||||
_LOGGER.debug("Hydration data fetched: %s", hydration_data)
|
||||
else:
|
||||
_LOGGER.debug("No hydration data found")
|
||||
|
||||
except GarminConnectAuthenticationError as err:
|
||||
_LOGGER.error(
|
||||
"Authentication error occurred during update: %s", err.response.text)
|
||||
raise ConfigEntryAuthFailed from err
|
||||
except GarminConnectTooManyRequestsError as err:
|
||||
_LOGGER.error(
|
||||
"Too many request error occurred during update: %s", err)
|
||||
return {}
|
||||
except GarminConnectConnectionError as err:
|
||||
_LOGGER.error("Connection error occurred during update: %s", err)
|
||||
raise ConfigEntryNotReady from err
|
||||
except requests.exceptions.HTTPError as err:
|
||||
if err.response.status_code == 401:
|
||||
_LOGGER.error(
|
||||
"Authentication error occurred during update: %s", err.response.text)
|
||||
raise ConfigEntryAuthFailed from err
|
||||
if err.response.status_code == 429:
|
||||
_LOGGER.error(
|
||||
"Too many requests error occurred during update: %s", err.response.text
|
||||
)
|
||||
return {}
|
||||
_LOGGER.error("Unknown HTTP error occurred during update: %s", err)
|
||||
return False
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
_LOGGER.exception("Unknown error occurred during update: %s", err)
|
||||
return {}
|
||||
|
||||
try:
|
||||
# Use gear data from the first fetch if available
|
||||
if gear:
|
||||
# Gear stats data like distance, time, etc.
|
||||
tasks: list[Awaitable] = [
|
||||
self.hass.async_add_executor_job(
|
||||
self.api.get_gear_stats, gear_item[Gear.UUID])
|
||||
for gear_item in gear
|
||||
]
|
||||
gear_stats = await asyncio.gather(*tasks)
|
||||
if gear_stats:
|
||||
_LOGGER.debug("Gear statistics data fetched: %s", gear_stats)
|
||||
else:
|
||||
_LOGGER.debug("No gear statistics data found")
|
||||
|
||||
# Gear defaults data like shoe, bike, etc.
|
||||
if Gear.USERPROFILE_ID in summary:
|
||||
gear_defaults = await self.hass.async_add_executor_job(
|
||||
self.api.get_gear_defaults, summary[Gear.USERPROFILE_ID]
|
||||
)
|
||||
if gear_defaults:
|
||||
_LOGGER.debug("Gear defaults data fetched: %s", gear_defaults)
|
||||
else:
|
||||
_LOGGER.debug("No gear defaults data found")
|
||||
else:
|
||||
_LOGGER.debug("No userProfileId found in summary, skipping gear defaults fetch")
|
||||
else:
|
||||
_LOGGER.debug("No gear data available, skipping gear stats and defaults fetch")
|
||||
else:
|
||||
_LOGGER.debug("No gear defaults data found")
|
||||
except GarminConnectAuthenticationError as err:
|
||||
_LOGGER.error(
|
||||
"Authentication error occurred while fetching Gear data: %s", err.response.text
|
||||
)
|
||||
raise ConfigEntryAuthFailed from err
|
||||
except GarminConnectTooManyRequestsError as err:
|
||||
_LOGGER.error(
|
||||
"Too many request error occurred while fetching Gear data: %s", err)
|
||||
raise ConfigEntryNotReady from err
|
||||
except GarminConnectConnectionError as err:
|
||||
_LOGGER.error(
|
||||
"Connection error occurred while fetching Gear data: %s", err)
|
||||
raise ConfigEntryNotReady from err
|
||||
except requests.exceptions.HTTPError as err:
|
||||
if err.response.status_code == 401:
|
||||
_LOGGER.error(
|
||||
"Authentication error while fetching Gear data: %s", err.response.text
|
||||
)
|
||||
elif err.response.status_code == 404:
|
||||
_LOGGER.error(
|
||||
"URL not found error while fetching Gear data: %s", err.response.text)
|
||||
elif err.response.status_code == 429:
|
||||
_LOGGER.error(
|
||||
"Too many requests error while fetching Gear data: %s", err.response.text
|
||||
)
|
||||
else:
|
||||
_LOGGER.error(
|
||||
"Unknown HTTP error occurred while fetching Gear data: %s", err)
|
||||
except (KeyError, TypeError, ValueError, ConnectionError) as err:
|
||||
_LOGGER.debug("Gear data is not available: %s", err)
|
||||
_LOGGER.debug("Error occurred while fetching Gear data: %s", err)
|
||||
|
||||
# Sleep score data
|
||||
try:
|
||||
sleep_score = sleep_data["dailySleepDTO"]["sleepScores"]["overall"]["value"]
|
||||
_LOGGER.debug("Sleep score data: %s", sleep_score)
|
||||
except KeyError:
|
||||
_LOGGER.debug("Sleep score data is not available")
|
||||
_LOGGER.debug("No sleep score data found")
|
||||
|
||||
# Sleep time seconds data
|
||||
try:
|
||||
sleep_time_seconds = sleep_data["dailySleepDTO"]["sleepTimeSeconds"]
|
||||
_LOGGER.debug("Sleep time seconds data: %s", sleep_time_seconds)
|
||||
if sleep_time_seconds:
|
||||
_LOGGER.debug("Sleep time seconds data: %s",
|
||||
sleep_time_seconds)
|
||||
else:
|
||||
_LOGGER.debug("No sleep time seconds data found")
|
||||
except KeyError:
|
||||
_LOGGER.debug("Sleep time seconds data is not available")
|
||||
_LOGGER.debug("No sleep time seconds data found")
|
||||
|
||||
# HRV data
|
||||
try:
|
||||
if hrv_data and "hrvSummary" in hrv_data:
|
||||
hrv_status = hrv_data["hrvSummary"]
|
||||
_LOGGER.debug("HRV summary: %s", hrv_status)
|
||||
_LOGGER.debug("HRV summary status: %s", hrv_status)
|
||||
except KeyError:
|
||||
_LOGGER.debug("HRV data is not available")
|
||||
_LOGGER.debug(
|
||||
"Error occurred while processing HRV summary status data")
|
||||
|
||||
# Endurance status
|
||||
try:
|
||||
if endurance_data and "overallScore" in endurance_data:
|
||||
endurance_status = endurance_data
|
||||
_LOGGER.debug("Endurance score: %s", endurance_status)
|
||||
except KeyError:
|
||||
_LOGGER.debug("Endurance data is not available")
|
||||
|
||||
return {
|
||||
**summary,
|
||||
@@ -243,18 +557,30 @@ class GarminConnectDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
"sleepScore": sleep_score,
|
||||
"sleepTimeSeconds": sleep_time_seconds,
|
||||
"hrvStatus": hrv_status,
|
||||
"enduranceScore": endurance_status,
|
||||
**fitnessage_data,
|
||||
**hydration_data,
|
||||
}
|
||||
|
||||
|
||||
def calculate_next_active_alarms(alarms, time_zone):
|
||||
"""
|
||||
Calculate garmin next active alarms from settings.
|
||||
Alarms are sorted by time.
|
||||
Calculate the next scheduled active Garmin alarms based on alarm settings and the current time.
|
||||
|
||||
Example of alarms data:
|
||||
Alarms data fetched: [{'alarmMode': 'OFF', 'alarmTime': 1233, 'alarmDays': ['ONCE'], 'alarmSound': 'TONE_AND_VIBRATION', 'alarmId': 1737308355, 'changeState': 'UNCHANGED', 'backlight': 'ON', 'enabled': None, 'alarmMessage': None, 'alarmImageId': None, 'alarmIcon': None, 'alarmType': None}]
|
||||
Filters alarms that are enabled and computes the next scheduled datetime for each alarm day, handling both one-time and recurring alarms. Returns a sorted list of ISO-formatted datetimes for upcoming alarms, or None if no active alarms are scheduled.
|
||||
|
||||
Parameters:
|
||||
alarms: List of alarm setting dictionaries from Garmin devices.
|
||||
time_zone: Time zone string used to localize alarm times.
|
||||
|
||||
Returns:
|
||||
A sorted list of ISO-formatted datetimes for the next active alarms, or None if none are scheduled.
|
||||
"""
|
||||
active_alarms = []
|
||||
|
||||
if not alarms:
|
||||
return active_alarms
|
||||
|
||||
now = datetime.now(ZoneInfo(time_zone))
|
||||
_LOGGER.debug("Now: %s, Alarms: %s", now, alarms)
|
||||
|
||||
@@ -284,8 +610,10 @@ def calculate_next_active_alarms(alarms, time_zone):
|
||||
)
|
||||
|
||||
days_to_add = DAY_TO_NUMBER[day] % 7
|
||||
alarm = start_of_week + timedelta(minutes=alarm_time, days=days_to_add)
|
||||
_LOGGER.debug("Start of week: %s, Alarm: %s", start_of_week, alarm)
|
||||
alarm = start_of_week + \
|
||||
timedelta(minutes=alarm_time, days=days_to_add)
|
||||
_LOGGER.debug("Start of week: %s, Alarm: %s",
|
||||
start_of_week, alarm)
|
||||
|
||||
# If the alarm time is in the past, move it to the next week
|
||||
if alarm < now:
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
"""Config flow for Garmin Connect integration."""
|
||||
|
||||
from collections.abc import Mapping
|
||||
import logging
|
||||
from typing import Any, cast
|
||||
|
||||
from garminconnect import (
|
||||
Garmin,
|
||||
@@ -8,65 +10,268 @@ from garminconnect import (
|
||||
GarminConnectConnectionError,
|
||||
GarminConnectTooManyRequestsError,
|
||||
)
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.const import CONF_ID, CONF_PASSWORD, CONF_USERNAME
|
||||
import garth
|
||||
from homeassistant.config_entries import (
|
||||
ConfigEntry,
|
||||
ConfigFlow,
|
||||
ConfigFlowResult,
|
||||
OptionsFlow,
|
||||
)
|
||||
from homeassistant.const import CONF_ID, CONF_PASSWORD, CONF_TOKEN, CONF_USERNAME
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
import requests
|
||||
import voluptuous as vol
|
||||
|
||||
from .const import DOMAIN
|
||||
from .const import CONF_MFA, CONF_SENSOR_GROUPS, DOMAIN
|
||||
from .sensor_descriptions import SENSOR_GROUPS, get_default_enabled_groups
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class GarminConnectConfigFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
class GarminConnectConfigFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
"""Handle a config flow for Garmin Connect."""
|
||||
|
||||
VERSION = 1
|
||||
|
||||
async def _show_setup_form(self, errors=None):
|
||||
"""Show the setup form to the user."""
|
||||
return self.async_show_form(
|
||||
step_id="user",
|
||||
data_schema=vol.Schema(
|
||||
{vol.Required(CONF_USERNAME): str, vol.Required(CONF_PASSWORD): str}
|
||||
),
|
||||
errors=errors or {},
|
||||
@staticmethod
|
||||
@callback
|
||||
def async_get_options_flow(config_entry: ConfigEntry) -> OptionsFlow:
|
||||
"""Get the options flow for this handler."""
|
||||
return GarminConnectOptionsFlowHandler(config_entry)
|
||||
|
||||
def __init__(self) -> None:
|
||||
"""
|
||||
Initialize schemas and internal state for the Garmin Connect configuration flow handler.
|
||||
|
||||
Sets up validation schemas for user credentials and MFA input, and initializes variables for API client, login results, MFA code, credentials, and region detection.
|
||||
"""
|
||||
self.data_schema = {
|
||||
vol.Required(CONF_USERNAME): str,
|
||||
vol.Required(CONF_PASSWORD): str,
|
||||
}
|
||||
self.mfa_data_schema = {
|
||||
vol.Required(CONF_MFA): str,
|
||||
}
|
||||
|
||||
self._api = None
|
||||
self._login_result1: Any = None
|
||||
self._login_result2: Any = None
|
||||
self._mfa_code: str | None = None
|
||||
self._username: str | None = None
|
||||
self._password: str | None = None
|
||||
self._in_china = False
|
||||
|
||||
async def _async_garmin_connect_login(self, step_id: str) -> ConfigFlowResult:
|
||||
"""
|
||||
Authenticate the user with Garmin Connect and handle login errors or multi-factor authentication requirements.
|
||||
|
||||
If the user is located in China, configures the API client for the region. Initiates the login process and, if multi-factor authentication is needed, transitions to the MFA step. Handles specific authentication and connection errors, returning appropriate error messages to the user. On successful authentication, proceeds to create or update the configuration entry.
|
||||
|
||||
Parameters:
|
||||
step_id (str): The current step identifier in the configuration flow.
|
||||
|
||||
Returns:
|
||||
ConfigFlowResult: The result of the configuration flow step, which may be a form with errors, a transition to MFA, or entry creation.
|
||||
"""
|
||||
errors = {}
|
||||
|
||||
# Check if the user resides in China
|
||||
country = self.hass.config.country
|
||||
if country == "CN":
|
||||
self._in_china = True
|
||||
|
||||
self._api = Garmin(
|
||||
email=self._username, password=self._password, return_on_mfa=True, is_cn=self._in_china
|
||||
)
|
||||
|
||||
async def async_step_user(self, user_input=None):
|
||||
"""Handle the initial step."""
|
||||
if user_input is None:
|
||||
return await self._show_setup_form()
|
||||
|
||||
username = user_input[CONF_USERNAME]
|
||||
password = user_input[CONF_PASSWORD]
|
||||
|
||||
api = Garmin(username, password)
|
||||
|
||||
errors = {}
|
||||
try:
|
||||
await self.hass.async_add_executor_job(api.login)
|
||||
self._login_result1, self._login_result2 = await self.hass.async_add_executor_job(
|
||||
self._api.login
|
||||
)
|
||||
|
||||
if self._login_result1 == "needs_mfa": # MFA is required
|
||||
return await self.async_step_mfa()
|
||||
|
||||
except GarminConnectConnectionError:
|
||||
errors["base"] = "cannot_connect"
|
||||
return await self._show_setup_form(errors)
|
||||
errors = {"base": "cannot_connect"}
|
||||
except GarminConnectAuthenticationError:
|
||||
errors["base"] = "invalid_auth"
|
||||
return await self._show_setup_form(errors)
|
||||
errors = {"base": "invalid_auth"}
|
||||
except GarminConnectTooManyRequestsError:
|
||||
errors["base"] = "too_many_requests"
|
||||
return await self._show_setup_form(errors)
|
||||
errors = {"base": "too_many_requests"}
|
||||
except requests.exceptions.HTTPError as err:
|
||||
if err.response.status_code == 403:
|
||||
errors = {"base": "invalid_auth"}
|
||||
elif err.response.status_code == 429:
|
||||
errors = {"base": "too_many_requests"}
|
||||
else:
|
||||
errors = {"base": "cannot_connect"}
|
||||
except Exception: # pylint: disable=broad-except
|
||||
_LOGGER.exception("Unexpected exception")
|
||||
errors["base"] = "unknown"
|
||||
return await self._show_setup_form(errors)
|
||||
errors = {"base": "unknown"}
|
||||
|
||||
await self.async_set_unique_id(username)
|
||||
self._abort_if_unique_id_configured()
|
||||
if errors:
|
||||
return self.async_show_form(
|
||||
step_id=step_id, data_schema=vol.Schema(self.data_schema), errors=errors
|
||||
)
|
||||
|
||||
return self.async_create_entry(
|
||||
title=username,
|
||||
data={
|
||||
CONF_ID: username,
|
||||
CONF_USERNAME: username,
|
||||
CONF_PASSWORD: password,
|
||||
return await self._async_create_entry()
|
||||
|
||||
async def _async_garmin_connect_mfa_login(self) -> ConfigFlowResult:
|
||||
"""
|
||||
Complete the Garmin Connect authentication process using the stored multi-factor authentication (MFA) code.
|
||||
|
||||
If the MFA code is invalid or an error occurs, prompts the user to re-enter the code. On successful authentication, creates or updates the configuration entry.
|
||||
"""
|
||||
try:
|
||||
await self.hass.async_add_executor_job(
|
||||
self._api.resume_login, self._login_result2, self._mfa_code
|
||||
)
|
||||
|
||||
except garth.exc.GarthException as err:
|
||||
_LOGGER.error("Error during MFA login: %s", err)
|
||||
return self.async_show_form(
|
||||
step_id="mfa",
|
||||
data_schema=vol.Schema(self.mfa_data_schema),
|
||||
errors={"base": "invalid_mfa_code"},
|
||||
)
|
||||
|
||||
return await self._async_create_entry()
|
||||
|
||||
async def _async_create_entry(self) -> ConfigFlowResult:
|
||||
"""
|
||||
Create or update the configuration entry for the Garmin Connect integration using the current user's credentials and API token.
|
||||
|
||||
If an entry with the same username exists, its data is updated and the entry is reloaded; otherwise, a new entry is created with the username as the unique ID and the serialized API token.
|
||||
"""
|
||||
config_data = {
|
||||
CONF_ID: self._username,
|
||||
CONF_TOKEN: self._api.garth.dumps(),
|
||||
}
|
||||
existing_entry = await self.async_set_unique_id(self._username)
|
||||
|
||||
if existing_entry:
|
||||
self.hass.config_entries.async_update_entry(existing_entry, data=config_data)
|
||||
await self.hass.config_entries.async_reload(existing_entry.entry_id)
|
||||
return self.async_abort(reason="reauth_successful")
|
||||
|
||||
return self.async_create_entry(title=cast(str, self._username), data=config_data)
|
||||
|
||||
async def async_step_user(self, user_input: dict[str, Any] | None = None) -> ConfigFlowResult:
|
||||
"""
|
||||
Handle the initial user step of the configuration flow.
|
||||
|
||||
If no input is provided, displays a form to collect username and password. If credentials are submitted, stores them and attempts authentication with Garmin Connect.
|
||||
"""
|
||||
if user_input is None:
|
||||
return self.async_show_form(step_id="user", data_schema=vol.Schema(self.data_schema))
|
||||
|
||||
self._username = user_input[CONF_USERNAME]
|
||||
self._password = user_input[CONF_PASSWORD]
|
||||
|
||||
return await self._async_garmin_connect_login(step_id="user")
|
||||
|
||||
async def async_step_mfa(self, user_input: dict[str, Any] | None = None) -> ConfigFlowResult:
|
||||
"""
|
||||
Handle the multi-factor authentication (MFA) step in the configuration flow.
|
||||
|
||||
If user input is not provided, displays a form to collect the MFA code. If input is provided, stores the MFA code and proceeds with MFA authentication.
|
||||
"""
|
||||
if user_input is None:
|
||||
return self.async_show_form(step_id="mfa", data_schema=vol.Schema(self.mfa_data_schema))
|
||||
|
||||
self._mfa_code = user_input[CONF_MFA]
|
||||
_LOGGER.debug("MFA code received")
|
||||
|
||||
return await self._async_garmin_connect_mfa_login()
|
||||
|
||||
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> ConfigFlowResult:
|
||||
"""
|
||||
Start the reauthorization process using existing configuration entry data.
|
||||
|
||||
Extracts the username from the entry data (using CONF_ID if CONF_USERNAME is not available for migrated entries) and advances to the reauthorization confirmation step.
|
||||
"""
|
||||
# For backward compatibility: try CONF_USERNAME first, fall back to CONF_ID
|
||||
self._username = entry_data.get(CONF_USERNAME) or entry_data.get(CONF_ID)
|
||||
|
||||
return await self.async_step_reauth_confirm()
|
||||
|
||||
async def async_step_reauth_confirm(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
"""
|
||||
Prompt the user to re-enter their username and password to confirm reauthorization of the Garmin Connect integration.
|
||||
|
||||
If credentials are provided, attempts to log in and complete the reauthorization process.
|
||||
"""
|
||||
if user_input is None:
|
||||
return self.async_show_form(
|
||||
step_id="reauth_confirm",
|
||||
data_schema=vol.Schema(
|
||||
{
|
||||
vol.Required(CONF_USERNAME, default=self._username): str,
|
||||
vol.Required(CONF_PASSWORD): str,
|
||||
}
|
||||
),
|
||||
)
|
||||
|
||||
self._username = user_input[CONF_USERNAME]
|
||||
self._password = user_input[CONF_PASSWORD]
|
||||
|
||||
return await self._async_garmin_connect_login(step_id="reauth_confirm")
|
||||
|
||||
|
||||
class GarminConnectOptionsFlowHandler(OptionsFlow):
|
||||
"""Handle options flow for Garmin Connect integration."""
|
||||
|
||||
def __init__(self, config_entry: ConfigEntry) -> None:
|
||||
"""Initialize options flow."""
|
||||
self.config_entry = config_entry
|
||||
|
||||
async def async_step_init(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
"""Manage the sensor group options."""
|
||||
if user_input is not None:
|
||||
# Convert list to set for storage
|
||||
enabled_groups = set(user_input.get(CONF_SENSOR_GROUPS, []))
|
||||
return self.async_create_entry(
|
||||
title="",
|
||||
data={CONF_SENSOR_GROUPS: list(enabled_groups)},
|
||||
)
|
||||
|
||||
# Get currently enabled groups from options, or use defaults for backward compatibility
|
||||
current_options = self.config_entry.options.get(CONF_SENSOR_GROUPS)
|
||||
if current_options is None:
|
||||
# First time setup or upgraded from version without options
|
||||
enabled_groups = get_default_enabled_groups()
|
||||
else:
|
||||
enabled_groups = set(current_options)
|
||||
|
||||
# Build the multi-select schema with descriptions
|
||||
options_schema = vol.Schema(
|
||||
{
|
||||
vol.Optional(
|
||||
CONF_SENSOR_GROUPS,
|
||||
default=list(enabled_groups),
|
||||
): cv.multi_select(
|
||||
{
|
||||
group_id: f"{group.name} - {group.description}"
|
||||
for group_id, group in SENSOR_GROUPS.items()
|
||||
}
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
return self.async_show_form(
|
||||
step_id="init",
|
||||
data_schema=options_schema,
|
||||
description_placeholders={
|
||||
"info": (
|
||||
"Select which sensor groups to enable. "
|
||||
"Individual sensors within enabled groups can still be "
|
||||
"disabled in the entity settings. "
|
||||
"Changes will be applied after reloading the integration."
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
@@ -4,12 +4,19 @@ from datetime import timedelta
|
||||
from typing import NamedTuple
|
||||
|
||||
from homeassistant.components.sensor import SensorDeviceClass, SensorStateClass
|
||||
from homeassistant.const import PERCENTAGE, UnitOfLength, UnitOfMass, UnitOfTime
|
||||
from homeassistant.const import (
|
||||
PERCENTAGE,
|
||||
UnitOfLength,
|
||||
UnitOfMass,
|
||||
UnitOfTime,
|
||||
UnitOfVolume,
|
||||
)
|
||||
|
||||
DOMAIN = "garmin_connect"
|
||||
DATA_COORDINATOR = "coordinator"
|
||||
DEFAULT_UPDATE_INTERVAL = timedelta(minutes=5)
|
||||
|
||||
CONF_MFA = "mfa_code"
|
||||
CONF_SENSOR_GROUPS = "sensor_groups"
|
||||
DAY_TO_NUMBER = {
|
||||
"Mo": 1,
|
||||
"M": 1,
|
||||
@@ -657,6 +664,86 @@ GARMIN_ENTITY_LIST = {
|
||||
None,
|
||||
True,
|
||||
],
|
||||
"enduranceScore": [
|
||||
"Endurance Score",
|
||||
None,
|
||||
"mdi:run",
|
||||
None,
|
||||
SensorStateClass.MEASUREMENT,
|
||||
False,
|
||||
],
|
||||
"chronologicalAge": [
|
||||
"Chronological Age",
|
||||
UnitOfTime.YEARS,
|
||||
"mdi:calendar-heart",
|
||||
None,
|
||||
SensorStateClass.MEASUREMENT,
|
||||
True,
|
||||
],
|
||||
"fitnessAge": [
|
||||
"Fitness Age",
|
||||
UnitOfTime.YEARS,
|
||||
"mdi:calendar-heart",
|
||||
None,
|
||||
SensorStateClass.MEASUREMENT,
|
||||
True,
|
||||
],
|
||||
"achievableFitnessAge": [
|
||||
"Achievable Fitness Age",
|
||||
UnitOfTime.YEARS,
|
||||
"mdi:calendar-heart",
|
||||
None,
|
||||
SensorStateClass.MEASUREMENT,
|
||||
True,
|
||||
],
|
||||
"previousFitnessAge": [
|
||||
"Previous Fitness Age",
|
||||
UnitOfTime.YEARS,
|
||||
"mdi:calendar-heart",
|
||||
None,
|
||||
SensorStateClass.MEASUREMENT,
|
||||
True,
|
||||
],
|
||||
"valueInML": [
|
||||
"Hydration",
|
||||
UnitOfVolume.MILLILITERS,
|
||||
"mdi:water",
|
||||
None,
|
||||
SensorStateClass.MEASUREMENT,
|
||||
True,
|
||||
],
|
||||
"goalInML": [
|
||||
"Hydration Goal",
|
||||
UnitOfVolume.MILLILITERS,
|
||||
"mdi:water",
|
||||
None,
|
||||
SensorStateClass.MEASUREMENT,
|
||||
True,
|
||||
],
|
||||
"dailyAverageInML": [
|
||||
"Hydration Daily Average",
|
||||
UnitOfVolume.MILLILITERS,
|
||||
"mdi:water",
|
||||
None,
|
||||
SensorStateClass.MEASUREMENT,
|
||||
True,
|
||||
],
|
||||
"sweatLossInML": [
|
||||
"Hydration Sweat Loss",
|
||||
UnitOfVolume.MILLILITERS,
|
||||
"mdi:water",
|
||||
None,
|
||||
SensorStateClass.MEASUREMENT,
|
||||
True,
|
||||
],
|
||||
"activityIntakeInML": [
|
||||
"Hydration Activity Intake",
|
||||
UnitOfVolume.MILLILITERS,
|
||||
"mdi:water",
|
||||
None,
|
||||
SensorStateClass.MEASUREMENT,
|
||||
True,
|
||||
],
|
||||
}
|
||||
|
||||
GEAR_ICONS = {
|
||||
|
||||
23
custom_components/garmin_connect/entity.py
Normal file
23
custom_components/garmin_connect/entity.py
Normal file
@@ -0,0 +1,23 @@
|
||||
"""Base entity for Garmin Connect integration."""
|
||||
|
||||
from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from .const import DOMAIN
|
||||
|
||||
|
||||
class GarminConnectEntity(CoordinatorEntity):
|
||||
"""Base entity for Garmin Connect."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(self, coordinator, unique_id: str) -> None:
|
||||
"""Initialize Garmin Connect entity."""
|
||||
super().__init__(coordinator)
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(DOMAIN, unique_id)},
|
||||
name="Garmin Connect",
|
||||
manufacturer="Garmin",
|
||||
model="Garmin Connect",
|
||||
entry_type=None,
|
||||
)
|
||||
@@ -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.24"],
|
||||
"version": "0.2.29"
|
||||
"requirements": ["garminconnect>=0.2.31"],
|
||||
"version": "0.2.35"
|
||||
}
|
||||
|
||||
@@ -25,13 +25,19 @@ from homeassistant.helpers.update_coordinator import (
|
||||
import voluptuous as vol
|
||||
|
||||
from .const import (
|
||||
CONF_SENSOR_GROUPS,
|
||||
DATA_COORDINATOR,
|
||||
DOMAIN as GARMIN_DOMAIN,
|
||||
GARMIN_ENTITY_LIST,
|
||||
GEAR_ICONS,
|
||||
Gear,
|
||||
ServiceSetting,
|
||||
)
|
||||
from .entity import GarminConnectEntity
|
||||
from .sensor_descriptions import (
|
||||
ALL_SENSOR_DESCRIPTIONS,
|
||||
get_default_enabled_groups,
|
||||
get_sensors_for_groups,
|
||||
)
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@@ -42,33 +48,41 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry, async_add_e
|
||||
unique_id = entry.data[CONF_ID]
|
||||
|
||||
entities = []
|
||||
for (
|
||||
sensor_type,
|
||||
(name, unit, icon, device_class, state_class, enabled_by_default),
|
||||
) in GARMIN_ENTITY_LIST.items():
|
||||
|
||||
# Get enabled sensor groups from options, or use defaults for backward compatibility
|
||||
enabled_groups_list = entry.options.get(CONF_SENSOR_GROUPS)
|
||||
if enabled_groups_list is None:
|
||||
# Backward compatibility: if no options set, enable all default groups
|
||||
enabled_groups = get_default_enabled_groups()
|
||||
else:
|
||||
# Convert list back to set
|
||||
enabled_groups = set(enabled_groups_list)
|
||||
|
||||
# Get sensor descriptions based on enabled groups
|
||||
sensor_descriptions = get_sensors_for_groups(enabled_groups)
|
||||
|
||||
_LOGGER.debug(
|
||||
"Setting up sensors with enabled groups: %s (%d sensors)",
|
||||
enabled_groups,
|
||||
len(sensor_descriptions),
|
||||
)
|
||||
|
||||
# Add main sensors using entity descriptions
|
||||
for description in sensor_descriptions:
|
||||
_LOGGER.debug(
|
||||
"Registering entity: %s, %s, %s, %s, %s, %s, %s",
|
||||
sensor_type,
|
||||
name,
|
||||
unit,
|
||||
icon,
|
||||
device_class,
|
||||
state_class,
|
||||
enabled_by_default,
|
||||
"Registering entity: %s (%s)",
|
||||
description.key,
|
||||
description.translation_key,
|
||||
)
|
||||
entities.append(
|
||||
GarminConnectSensor(
|
||||
coordinator,
|
||||
unique_id,
|
||||
sensor_type,
|
||||
name,
|
||||
unit,
|
||||
icon,
|
||||
device_class,
|
||||
state_class,
|
||||
enabled_by_default,
|
||||
description,
|
||||
)
|
||||
)
|
||||
|
||||
# Add gear sensors
|
||||
if "gear" in coordinator.data:
|
||||
for gear_item in coordinator.data["gear"]:
|
||||
name = gear_item["displayName"]
|
||||
@@ -81,15 +95,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry, async_add_e
|
||||
enabled_by_default = True
|
||||
|
||||
_LOGGER.debug(
|
||||
"Registering entity: %s, %s, %s, %s, %s, %s, %s, %s",
|
||||
"Registering gear entity: %s, %s, %s",
|
||||
sensor_type,
|
||||
name,
|
||||
unit,
|
||||
icon,
|
||||
uuid,
|
||||
device_class,
|
||||
state_class,
|
||||
enabled_by_default,
|
||||
)
|
||||
entities.append(
|
||||
GarminConnectGearSensor(
|
||||
@@ -154,133 +163,134 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry, async_add_e
|
||||
)
|
||||
|
||||
|
||||
class GarminConnectSensor(CoordinatorEntity, SensorEntity):
|
||||
class GarminConnectSensor(GarminConnectEntity, SensorEntity):
|
||||
"""Representation of a Garmin Connect Sensor."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
coordinator,
|
||||
unique_id,
|
||||
sensor_type,
|
||||
name,
|
||||
unit,
|
||||
icon,
|
||||
device_class,
|
||||
state_class,
|
||||
enabled_default: bool = True,
|
||||
coordinator: DataUpdateCoordinator,
|
||||
unique_id: str,
|
||||
description,
|
||||
):
|
||||
"""Initialize a Garmin Connect sensor."""
|
||||
super().__init__(coordinator)
|
||||
|
||||
self._unique_id = unique_id
|
||||
self._type = sensor_type
|
||||
self._device_class = device_class
|
||||
self._state_class = state_class
|
||||
self._enabled_default = enabled_default
|
||||
|
||||
self._attr_name = name
|
||||
self._attr_device_class = self._device_class
|
||||
self._attr_icon = icon
|
||||
self._attr_native_unit_of_measurement = unit
|
||||
self._attr_unique_id = f"{self._unique_id}_{self._type}"
|
||||
self._attr_state_class = state_class
|
||||
super().__init__(coordinator, unique_id)
|
||||
self.entity_description = description
|
||||
self._attr_unique_id = f"{unique_id}_{description.key}"
|
||||
|
||||
@property
|
||||
def native_value(self):
|
||||
"""Return the state of the sensor."""
|
||||
"""
|
||||
Return the current value of the sensor.
|
||||
|
||||
Uses the entity description's value_fn if provided, otherwise applies
|
||||
type-specific formatting and conversions for backward compatibility.
|
||||
"""
|
||||
if not self.coordinator.data:
|
||||
return None
|
||||
|
||||
value = self.coordinator.data.get(self._type)
|
||||
# Use custom value function if provided in description
|
||||
if self.entity_description.value_fn:
|
||||
return self.entity_description.value_fn(self.coordinator.data)
|
||||
|
||||
# Fallback to legacy value extraction
|
||||
value = self.coordinator.data.get(self.entity_description.key)
|
||||
if value is None:
|
||||
return None
|
||||
|
||||
if self._type == "lastActivities" or self._type == "badges":
|
||||
value = len(self.coordinator.data[self._type])
|
||||
# Legacy type-specific handling
|
||||
sensor_type = self.entity_description.key
|
||||
|
||||
if self._type == "lastActivity":
|
||||
value = self.coordinator.data[self._type]["activityName"]
|
||||
if sensor_type == "lastActivities" or sensor_type == "badges":
|
||||
value = len(self.coordinator.data[sensor_type])
|
||||
|
||||
elif self._type == "hrvStatus":
|
||||
value = self.coordinator.data[self._type]["status"].capitalize()
|
||||
elif sensor_type == "lastActivity":
|
||||
value = self.coordinator.data[sensor_type]["activityName"]
|
||||
|
||||
elif "Duration" in self._type or "Seconds" in self._type:
|
||||
value = round(value // 60, 2)
|
||||
elif sensor_type == "enduranceScore":
|
||||
value = self.coordinator.data[sensor_type]["overallScore"]
|
||||
|
||||
elif "Mass" in self._type or self._type == "weight":
|
||||
value = round(value / 1000, 2)
|
||||
|
||||
elif self._type == "nextAlarm":
|
||||
active_alarms = self.coordinator.data[self._type]
|
||||
_LOGGER.debug("Active alarms: %s", active_alarms)
|
||||
elif sensor_type == "nextAlarm":
|
||||
active_alarms = self.coordinator.data[sensor_type]
|
||||
if active_alarms:
|
||||
_LOGGER.debug("Active alarms: %s", active_alarms)
|
||||
_LOGGER.debug("Next alarm: %s", active_alarms[0])
|
||||
value = active_alarms[0]
|
||||
else:
|
||||
value = None
|
||||
|
||||
elif self._type == "stressQualifier":
|
||||
value = value.capitalize()
|
||||
|
||||
if self._device_class == SensorDeviceClass.TIMESTAMP:
|
||||
# Handle timestamp device class
|
||||
if self.entity_description.device_class == SensorDeviceClass.TIMESTAMP:
|
||||
if value:
|
||||
value = datetime.datetime.fromisoformat(value).replace(
|
||||
tzinfo=ZoneInfo(self.coordinator.time_zone)
|
||||
)
|
||||
|
||||
return round(value, 2) if isinstance(value, Number) else value
|
||||
|
||||
@property
|
||||
def extra_state_attributes(self):
|
||||
"""Return attributes for sensor."""
|
||||
"""
|
||||
Return additional state attributes for the sensor entity.
|
||||
|
||||
Uses the entity description's attributes_fn if provided, otherwise
|
||||
returns sensor-specific attributes for backward compatibility.
|
||||
"""
|
||||
if not self.coordinator.data:
|
||||
return {}
|
||||
|
||||
# Use custom attributes function if provided in description
|
||||
if self.entity_description.attributes_fn:
|
||||
return self.entity_description.attributes_fn(self.coordinator.data)
|
||||
|
||||
# Base attributes
|
||||
attributes = {
|
||||
"last_synced": self.coordinator.data["lastSyncTimestampGMT"],
|
||||
}
|
||||
|
||||
if self._type == "lastActivities":
|
||||
attributes["last_activities"] = self.coordinator.data[self._type]
|
||||
sensor_type = self.entity_description.key
|
||||
|
||||
if self._type == "lastActivity":
|
||||
attributes = {**attributes, **self.coordinator.data[self._type]}
|
||||
# Only keep the last 5 activities for performance reasons
|
||||
if sensor_type == "lastActivities":
|
||||
activities = self.coordinator.data.get(sensor_type, [])
|
||||
sorted_activities = sorted(activities, key=lambda x: x["activityId"])
|
||||
attributes["last_activities"] = sorted_activities[-5:]
|
||||
|
||||
# Only show the last 10 badges for performance reasons
|
||||
if self._type == "badges":
|
||||
badges = self.coordinator.data.get(self._type, [])
|
||||
elif sensor_type == "lastActivity":
|
||||
attributes = {**attributes, **self.coordinator.data[sensor_type]}
|
||||
|
||||
# Only keep the last 10 badges for performance reasons
|
||||
elif sensor_type == "badges":
|
||||
badges = self.coordinator.data.get(sensor_type, [])
|
||||
sorted_badges = sorted(badges, key=lambda x: x["badgeEarnedDate"])
|
||||
attributes["badges"] = sorted_badges[-10:]
|
||||
|
||||
if self._type == "nextAlarm":
|
||||
attributes["next_alarms"] = self.coordinator.data[self._type]
|
||||
elif sensor_type == "nextAlarm":
|
||||
attributes["next_alarms"] = self.coordinator.data[sensor_type]
|
||||
|
||||
if self._type == "hrvStatus":
|
||||
attributes = {**attributes, **self.coordinator.data[self._type]}
|
||||
del attributes["status"]
|
||||
elif sensor_type == "enduranceScore":
|
||||
attributes = {**attributes, **self.coordinator.data[sensor_type]}
|
||||
del attributes["overallScore"]
|
||||
|
||||
return attributes
|
||||
|
||||
@property
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information."""
|
||||
return {
|
||||
"identifiers": {(GARMIN_DOMAIN, self._unique_id)},
|
||||
"name": "Garmin Connect",
|
||||
"manufacturer": "Garmin Connect",
|
||||
}
|
||||
|
||||
@property
|
||||
def entity_registry_enabled_default(self) -> bool:
|
||||
"""Return if the entity should be enabled when first added to the entity registry."""
|
||||
return self._enabled_default
|
||||
|
||||
@property
|
||||
def available(self) -> bool:
|
||||
"""Return True if entity is available."""
|
||||
return super().available and self.coordinator.data and self._type in self.coordinator.data
|
||||
return (
|
||||
super().available
|
||||
and self.coordinator.data
|
||||
and self.entity_description.key in self.coordinator.data
|
||||
)
|
||||
|
||||
async def add_body_composition(self, **kwargs):
|
||||
"""Handle the service call to add body composition."""
|
||||
"""
|
||||
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.
|
||||
|
||||
Raises:
|
||||
IntegrationError: If login to Garmin Connect fails.
|
||||
"""
|
||||
weight = kwargs.get("weight")
|
||||
timestamp = kwargs.get("timestamp")
|
||||
percent_fat = kwargs.get("percent_fat")
|
||||
@@ -318,7 +328,19 @@ class GarminConnectSensor(CoordinatorEntity, SensorEntity):
|
||||
)
|
||||
|
||||
async def add_blood_pressure(self, **kwargs):
|
||||
"""Handle the service call to add blood pressure."""
|
||||
"""
|
||||
Add a blood pressure measurement to Garmin Connect using the provided values.
|
||||
|
||||
Parameters:
|
||||
systolic: Systolic blood pressure value.
|
||||
diastolic: Diastolic blood pressure value.
|
||||
pulse: Pulse rate.
|
||||
timestamp: Optional timestamp for the measurement.
|
||||
notes: Optional notes for the measurement.
|
||||
|
||||
Raises:
|
||||
IntegrationError: If unable to log in to Garmin Connect.
|
||||
"""
|
||||
timestamp = kwargs.get("timestamp")
|
||||
systolic = kwargs.get("systolic")
|
||||
diastolic = kwargs.get("diastolic")
|
||||
@@ -331,13 +353,20 @@ class GarminConnectSensor(CoordinatorEntity, SensorEntity):
|
||||
|
||||
"""Record a blood pressure measurement."""
|
||||
await self.hass.async_add_executor_job(
|
||||
self.coordinator.api.set_blood_pressure, systolic, diastolic, pulse, timestamp, notes
|
||||
self.coordinator.api.set_blood_pressure,
|
||||
systolic,
|
||||
diastolic,
|
||||
pulse,
|
||||
timestamp,
|
||||
notes,
|
||||
)
|
||||
|
||||
|
||||
class GarminConnectGearSensor(CoordinatorEntity, SensorEntity):
|
||||
"""Representation of a Garmin Connect Gear Sensor."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
coordinator,
|
||||
@@ -384,7 +413,11 @@ class GarminConnectGearSensor(CoordinatorEntity, SensorEntity):
|
||||
|
||||
@property
|
||||
def extra_state_attributes(self):
|
||||
"""Return attributes for sensor."""
|
||||
"""
|
||||
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.
|
||||
"""
|
||||
gear = self._gear()
|
||||
stats = self._stats()
|
||||
gear_defaults = self._gear_defaults()
|
||||
@@ -422,11 +455,13 @@ class GarminConnectGearSensor(CoordinatorEntity, SensorEntity):
|
||||
@property
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information."""
|
||||
return {
|
||||
"identifiers": {(GARMIN_DOMAIN, self._unique_id)},
|
||||
"name": "Garmin Connect",
|
||||
"manufacturer": "Garmin Connect",
|
||||
}
|
||||
return DeviceInfo(
|
||||
identifiers={(GARMIN_DOMAIN, self._unique_id)},
|
||||
name="Garmin Connect",
|
||||
manufacturer="Garmin",
|
||||
model="Garmin Connect",
|
||||
entry_type=None,
|
||||
)
|
||||
|
||||
@property
|
||||
def entity_registry_enabled_default(self) -> bool:
|
||||
@@ -451,7 +486,12 @@ class GarminConnectGearSensor(CoordinatorEntity, SensorEntity):
|
||||
return gear_item
|
||||
|
||||
def _gear_defaults(self):
|
||||
"""Get gear defaults"""
|
||||
"""
|
||||
Return a list of default gear settings for this gear UUID.
|
||||
|
||||
Returns:
|
||||
List of gear default dictionaries where this gear is set as the default.
|
||||
"""
|
||||
return list(
|
||||
filter(
|
||||
lambda d: d[Gear.UUID] == self.uuid and d["defaultGear"] is True,
|
||||
@@ -460,7 +500,16 @@ class GarminConnectGearSensor(CoordinatorEntity, SensorEntity):
|
||||
)
|
||||
|
||||
async def set_active_gear(self, **kwargs):
|
||||
"""Handle the service call to set active gear."""
|
||||
"""
|
||||
Set this gear as active or default for a specified activity type in Garmin Connect.
|
||||
|
||||
Parameters:
|
||||
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.
|
||||
|
||||
Raises:
|
||||
IntegrationError: If unable to log in to Garmin Connect.
|
||||
"""
|
||||
activity_type = kwargs.get("activity_type")
|
||||
setting = kwargs.get("setting")
|
||||
|
||||
@@ -484,7 +533,8 @@ class GarminConnectGearSensor(CoordinatorEntity, SensorEntity):
|
||||
)
|
||||
else:
|
||||
old_default_state = await self.hass.async_add_executor_job(
|
||||
self.coordinator.api.get_gear_defaults, self.coordinator.data[Gear.USERPROFILE_ID]
|
||||
self.coordinator.api.get_gear_defaults,
|
||||
self.coordinator.data[Gear.USERPROFILE_ID],
|
||||
)
|
||||
to_deactivate = list(
|
||||
filter(
|
||||
@@ -502,5 +552,8 @@ class GarminConnectGearSensor(CoordinatorEntity, SensorEntity):
|
||||
False,
|
||||
)
|
||||
await self.hass.async_add_executor_job(
|
||||
self.coordinator.api.set_gear_default, activity_type_id, self._uuid, True
|
||||
self.coordinator.api.set_gear_default,
|
||||
activity_type_id,
|
||||
self._uuid,
|
||||
True,
|
||||
)
|
||||
|
||||
1038
custom_components/garmin_connect/sensor_descriptions.py
Normal file
1038
custom_components/garmin_connect/sensor_descriptions.py
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,21 +1,47 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "[%key:common::config_flow::abort::already_configured_account%]"
|
||||
"step": {
|
||||
"user": {
|
||||
"title": "Enter your Garmin Connect login information",
|
||||
"data": {
|
||||
"username": "[%key:common::config_flow::data::username%]",
|
||||
"password": "[%key:common::config_flow::data::password%]"
|
||||
}
|
||||
},
|
||||
"mfa": {
|
||||
"title": "Enter your Garmin Connect MFA code",
|
||||
"data": {
|
||||
"mfa_code": "MFA code (6-digits)"
|
||||
}
|
||||
},
|
||||
"reauth_confirm": {
|
||||
"title": "[%key:component::garmin_connect::config::step::user::title%]",
|
||||
"data": {
|
||||
"username": "[%key:common::config_flow::data::username%]",
|
||||
"password": "[%key:common::config_flow::data::password%]"
|
||||
}
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
|
||||
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
|
||||
"too_many_requests": "Too many requests, retry later.",
|
||||
"unknown": "[%key:common::config_flow::error::unknown%]"
|
||||
"too_many_requests": "Too many requests, retry later",
|
||||
"unknown": "[%key:common::config_flow::error::unknown%]",
|
||||
"invalid_mfa_code": "Invalid MFA code"
|
||||
},
|
||||
"abort": {
|
||||
"already_configured": "[%key:common::config_flow::abort::already_configured_account%]",
|
||||
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"step": {
|
||||
"user": {
|
||||
"init": {
|
||||
"title": "Configure Sensor Groups",
|
||||
"description": "Select which sensor groups to enable. Individual sensors within enabled groups can still be disabled in the entity settings. Changes will be applied after reloading the integration.",
|
||||
"data": {
|
||||
"password": "[%key:common::config_flow::data::password%]",
|
||||
"username": "[%key:common::config_flow::data::username%]"
|
||||
},
|
||||
"description": "Enter your credentials."
|
||||
"sensor_groups": "Enabled Sensor Groups"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "[%key::common::config_flow::abort::already_configured_account%]"
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "Ha fallat la connexi\u00f3",
|
||||
"invalid_auth": "Autenticaci\u00f3 inv\u00e0lida",
|
||||
"too_many_requests": "Massa sol\u00b7licituds, torna-ho a intentar m\u00e9s tard.",
|
||||
"unknown": "Error inesperat"
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"password": "Contrasenya",
|
||||
"username": "Nom d'usuari"
|
||||
},
|
||||
"description": "Introdueix les teves credencials.",
|
||||
"title": "Garmin Connect"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "\u00da\u010det je ji\u017e nastaven"
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "Nepoda\u0159ilo se p\u0159ipojit",
|
||||
"invalid_auth": "Neplatn\u00e9 ov\u011b\u0159en\u00ed",
|
||||
"too_many_requests": "P\u0159\u00edli\u0161 mnoho po\u017eadavk\u016f, opakujte to pozd\u011bji.",
|
||||
"unknown": "Neo\u010dek\u00e1van\u00e1 chyba"
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"password": "Heslo",
|
||||
"username": "U\u017eivatelsk\u00e9 jm\u00e9no"
|
||||
},
|
||||
"description": "Zadejte sv\u00e9 p\u0159ihla\u0161ovac\u00ed \u00fadaje.",
|
||||
"title": "Garmin Connect"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "Denne konto er allerede konfigureret."
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "Kunne ikke oprette forbindelse - pr\u00f8v igen.",
|
||||
"invalid_auth": "Ugyldig godkendelse.",
|
||||
"too_many_requests": "For mange anmodninger - pr\u00f8v igen senere.",
|
||||
"unknown": "Uventet fejl."
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"password": "Adgangskode",
|
||||
"username": "Brugernavn"
|
||||
},
|
||||
"description": "Indtast dine legitimationsoplysninger.",
|
||||
"title": "Garmin Connect"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "Dieses Konto ist bereits konfiguriert."
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "Verbindung fehlgeschlagen",
|
||||
"invalid_auth": "Ung\u00fcltige Authentifizierung",
|
||||
"too_many_requests": "Zu viele Anfragen, versuche es sp\u00e4ter erneut.",
|
||||
"unknown": "Unerwarteter Fehler"
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"password": "Passwort",
|
||||
"username": "Benutzername"
|
||||
},
|
||||
"description": "Geben Sie Ihre Zugangsdaten ein.",
|
||||
"title": "Garmin Connect"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,341 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "Account is already configured"
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "Failed to connect",
|
||||
"invalid_auth": "Invalid authentication",
|
||||
"too_many_requests": "Too many requests, retry later.",
|
||||
"unknown": "Unexpected error"
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"title": "Enter your Garmin Connect credentials",
|
||||
"data": {
|
||||
"password": "Password",
|
||||
"username": "Username"
|
||||
},
|
||||
"description": "Enter your credentials."
|
||||
},
|
||||
"mfa": {
|
||||
"title": "Enter your Garmin Connect MFA code",
|
||||
"data": {
|
||||
"mfa_code": "MFA code (6-digits)"
|
||||
}
|
||||
},
|
||||
"reauth_confirm": {
|
||||
"title": "Enter your Garmin Connect credentials",
|
||||
"data": {
|
||||
"password": "Password",
|
||||
"username": "Username"
|
||||
}
|
||||
}
|
||||
},
|
||||
"abort": {
|
||||
"already_configured": "Account is already configured",
|
||||
"reauth_successful": "Reauthentication successful"
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "Failed to connect",
|
||||
"invalid_auth": "Invalid authentication",
|
||||
"too_many_requests": "Too many requests, retry later",
|
||||
"unknown": "Unexpected error",
|
||||
"invalid_mfa_code": "Invalid MFA code"
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"total_steps": {
|
||||
"name": "Total steps"
|
||||
},
|
||||
"daily_step_goal": {
|
||||
"name": "Daily step goal"
|
||||
},
|
||||
"total_distance": {
|
||||
"name": "Total distance"
|
||||
},
|
||||
"floors_ascended": {
|
||||
"name": "Floors ascended"
|
||||
},
|
||||
"floors_descended": {
|
||||
"name": "Floors descended"
|
||||
},
|
||||
"floors_ascended_goal": {
|
||||
"name": "Floors ascended goal"
|
||||
},
|
||||
"floors_ascended_meters": {
|
||||
"name": "Floors ascended (meters)"
|
||||
},
|
||||
"floors_descended_meters": {
|
||||
"name": "Floors descended (meters)"
|
||||
},
|
||||
"total_calories": {
|
||||
"name": "Total calories"
|
||||
},
|
||||
"active_calories": {
|
||||
"name": "Active calories"
|
||||
},
|
||||
"bmr_calories": {
|
||||
"name": "BMR calories"
|
||||
},
|
||||
"burned_calories": {
|
||||
"name": "Burned calories"
|
||||
},
|
||||
"consumed_calories": {
|
||||
"name": "Consumed calories"
|
||||
},
|
||||
"remaining_calories": {
|
||||
"name": "Remaining calories"
|
||||
},
|
||||
"resting_heart_rate": {
|
||||
"name": "Resting heart rate"
|
||||
},
|
||||
"max_heart_rate": {
|
||||
"name": "Max heart rate"
|
||||
},
|
||||
"min_heart_rate": {
|
||||
"name": "Min heart rate"
|
||||
},
|
||||
"last_7_days_avg_resting_heart_rate": {
|
||||
"name": "Last 7 days avg resting heart rate"
|
||||
},
|
||||
"min_avg_heart_rate": {
|
||||
"name": "Min avg heart rate"
|
||||
},
|
||||
"max_avg_heart_rate": {
|
||||
"name": "Max avg heart rate"
|
||||
},
|
||||
"abnormal_hr_alerts": {
|
||||
"name": "Abnormal HR alerts"
|
||||
},
|
||||
"hrv_status": {
|
||||
"name": "HRV status"
|
||||
},
|
||||
"avg_stress_level": {
|
||||
"name": "Avg stress level"
|
||||
},
|
||||
"max_stress_level": {
|
||||
"name": "Max stress level"
|
||||
},
|
||||
"stress_qualifier": {
|
||||
"name": "Stress qualifier"
|
||||
},
|
||||
"total_stress_duration": {
|
||||
"name": "Total stress duration"
|
||||
},
|
||||
"rest_stress_duration": {
|
||||
"name": "Rest stress duration"
|
||||
},
|
||||
"activity_stress_duration": {
|
||||
"name": "Activity stress duration"
|
||||
},
|
||||
"low_stress_duration": {
|
||||
"name": "Low stress duration"
|
||||
},
|
||||
"medium_stress_duration": {
|
||||
"name": "Medium stress duration"
|
||||
},
|
||||
"high_stress_duration": {
|
||||
"name": "High stress duration"
|
||||
},
|
||||
"uncategorized_stress_duration": {
|
||||
"name": "Uncategorized stress duration"
|
||||
},
|
||||
"stress_duration": {
|
||||
"name": "Stress duration"
|
||||
},
|
||||
"stress_percentage": {
|
||||
"name": "Stress percentage"
|
||||
},
|
||||
"rest_stress_percentage": {
|
||||
"name": "Rest stress percentage"
|
||||
},
|
||||
"activity_stress_percentage": {
|
||||
"name": "Activity stress percentage"
|
||||
},
|
||||
"uncategorized_stress_percentage": {
|
||||
"name": "Uncategorized stress percentage"
|
||||
},
|
||||
"low_stress_percentage": {
|
||||
"name": "Low stress percentage"
|
||||
},
|
||||
"medium_stress_percentage": {
|
||||
"name": "Medium stress percentage"
|
||||
},
|
||||
"high_stress_percentage": {
|
||||
"name": "High stress percentage"
|
||||
},
|
||||
"sleeping_time": {
|
||||
"name": "Sleeping time"
|
||||
},
|
||||
"total_sleep_duration": {
|
||||
"name": "Total sleep duration"
|
||||
},
|
||||
"sleep_duration": {
|
||||
"name": "Sleep duration"
|
||||
},
|
||||
"awake_duration": {
|
||||
"name": "Awake duration"
|
||||
},
|
||||
"sleep_score": {
|
||||
"name": "Sleep score"
|
||||
},
|
||||
"body_battery_most_recent": {
|
||||
"name": "Body battery (most recent)"
|
||||
},
|
||||
"body_battery_highest": {
|
||||
"name": "Body battery (highest)"
|
||||
},
|
||||
"body_battery_lowest": {
|
||||
"name": "Body battery (lowest)"
|
||||
},
|
||||
"body_battery_charged": {
|
||||
"name": "Body battery charged"
|
||||
},
|
||||
"body_battery_drained": {
|
||||
"name": "Body battery drained"
|
||||
},
|
||||
"weight": {
|
||||
"name": "Weight"
|
||||
},
|
||||
"bmi": {
|
||||
"name": "BMI"
|
||||
},
|
||||
"body_fat": {
|
||||
"name": "Body fat"
|
||||
},
|
||||
"body_water": {
|
||||
"name": "Body water"
|
||||
},
|
||||
"bone_mass": {
|
||||
"name": "Bone mass"
|
||||
},
|
||||
"muscle_mass": {
|
||||
"name": "Muscle mass"
|
||||
},
|
||||
"physique_rating": {
|
||||
"name": "Physique rating"
|
||||
},
|
||||
"visceral_fat": {
|
||||
"name": "Visceral fat"
|
||||
},
|
||||
"metabolic_age": {
|
||||
"name": "Metabolic age"
|
||||
},
|
||||
"hydration": {
|
||||
"name": "Hydration"
|
||||
},
|
||||
"hydration_goal": {
|
||||
"name": "Hydration goal"
|
||||
},
|
||||
"hydration_daily_average": {
|
||||
"name": "Hydration daily average"
|
||||
},
|
||||
"hydration_sweat_loss": {
|
||||
"name": "Hydration sweat loss"
|
||||
},
|
||||
"hydration_activity_intake": {
|
||||
"name": "Hydration activity intake"
|
||||
},
|
||||
"active_time": {
|
||||
"name": "Active time"
|
||||
},
|
||||
"highly_active_time": {
|
||||
"name": "Highly active time"
|
||||
},
|
||||
"sedentary_time": {
|
||||
"name": "Sedentary time"
|
||||
},
|
||||
"moderate_intensity": {
|
||||
"name": "Moderate intensity"
|
||||
},
|
||||
"vigorous_intensity": {
|
||||
"name": "Vigorous intensity"
|
||||
},
|
||||
"intensity_goal": {
|
||||
"name": "Intensity goal"
|
||||
},
|
||||
"avg_spo2": {
|
||||
"name": "Avg SpO2"
|
||||
},
|
||||
"lowest_spo2": {
|
||||
"name": "Lowest SpO2"
|
||||
},
|
||||
"latest_spo2": {
|
||||
"name": "Latest SpO2"
|
||||
},
|
||||
"latest_spo2_time": {
|
||||
"name": "Latest SpO2 time"
|
||||
},
|
||||
"highest_respiration": {
|
||||
"name": "Highest respiration"
|
||||
},
|
||||
"lowest_respiration": {
|
||||
"name": "Lowest respiration"
|
||||
},
|
||||
"latest_respiration": {
|
||||
"name": "Latest respiration"
|
||||
},
|
||||
"latest_respiration_time": {
|
||||
"name": "Latest respiration time"
|
||||
},
|
||||
"avg_altitude": {
|
||||
"name": "Avg altitude"
|
||||
},
|
||||
"chronological_age": {
|
||||
"name": "Chronological age"
|
||||
},
|
||||
"fitness_age": {
|
||||
"name": "Fitness age"
|
||||
},
|
||||
"achievable_fitness_age": {
|
||||
"name": "Achievable fitness age"
|
||||
},
|
||||
"previous_fitness_age": {
|
||||
"name": "Previous fitness age"
|
||||
},
|
||||
"endurance_score": {
|
||||
"name": "Endurance score"
|
||||
},
|
||||
"next_alarm": {
|
||||
"name": "Next alarm"
|
||||
},
|
||||
"last_activity": {
|
||||
"name": "Last activity"
|
||||
},
|
||||
"last_activities": {
|
||||
"name": "Last activities"
|
||||
},
|
||||
"badges": {
|
||||
"name": "Badges"
|
||||
},
|
||||
"user_points": {
|
||||
"name": "User points"
|
||||
},
|
||||
"user_level": {
|
||||
"name": "User level"
|
||||
},
|
||||
"wellness_start_time": {
|
||||
"name": "Wellness start time"
|
||||
},
|
||||
"wellness_end_time": {
|
||||
"name": "Wellness end time"
|
||||
},
|
||||
"wellness_description": {
|
||||
"name": "Wellness description"
|
||||
},
|
||||
"wellness_distance": {
|
||||
"name": "Wellness distance"
|
||||
},
|
||||
"wellness_active_calories": {
|
||||
"name": "Wellness active calories"
|
||||
},
|
||||
"wellness_calories": {
|
||||
"name": "Wellness calories"
|
||||
}
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"step": {
|
||||
"init": {
|
||||
"title": "Configure Sensor Groups",
|
||||
"description": "Select which sensor groups to enable. Individual sensors within enabled groups can still be disabled in the entity settings. Changes will be applied after reloading the integration.",
|
||||
"data": {
|
||||
"sensor_groups": "Enabled Sensor Groups"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "Esta cuenta ya est\u00e1 configurada."
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "No se pudo conectar, intente nuevamente.",
|
||||
"invalid_auth": "Autenticaci\u00f3n inv\u00e1lida",
|
||||
"too_many_requests": "Demasiadas solicitudes, vuelva a intentarlo m\u00e1s tarde.",
|
||||
"unknown": "Error inesperado."
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"password": "Contrase\u00f1a",
|
||||
"username": "Nombre de usuario"
|
||||
},
|
||||
"description": "Ingrese sus credenciales.",
|
||||
"title": "Garmin Connect"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "La cuenta ya ha sido configurada"
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "No se pudo conectar",
|
||||
"invalid_auth": "Autenticaci\u00f3n no v\u00e1lida",
|
||||
"too_many_requests": "Demasiadas solicitudes, vuelva a intentarlo m\u00e1s tarde.",
|
||||
"unknown": "Error inesperado"
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"password": "Contrase\u00f1a",
|
||||
"username": "Usuario"
|
||||
},
|
||||
"description": "Introduzca sus credenciales.",
|
||||
"title": "Garmin Connect"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "Konto on juba seadistatud"
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "\u00dchendamine nurjus",
|
||||
"invalid_auth": "Tuvastamine nurjus",
|
||||
"too_many_requests": "Liiga palju taotlusi, proovi hiljem uuesti.",
|
||||
"unknown": "Tundmatu viga"
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"password": "Salas\u00f5na",
|
||||
"username": "Kasutajanimi"
|
||||
},
|
||||
"description": "Sisesta oma mandaat.",
|
||||
"title": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "Ce compte est d\u00e9j\u00e0 configur\u00e9."
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "Impossible de se connecter, veuillez r\u00e9essayer.",
|
||||
"invalid_auth": "Authentification non valide.",
|
||||
"too_many_requests": "Trop de demandes, r\u00e9essayez plus tard.",
|
||||
"unknown": "Erreur inattendue."
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"password": "Mot de passe",
|
||||
"username": "Nom d'utilisateur"
|
||||
},
|
||||
"description": "Entrez vos informations d'identification.",
|
||||
"title": "Garmin Connect"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "\u05ea\u05e6\u05d5\u05e8\u05ea \u05d4\u05d7\u05e9\u05d1\u05d5\u05df \u05db\u05d1\u05e8 \u05e0\u05e7\u05d1\u05e2\u05d4"
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "\u05d4\u05d4\u05ea\u05d7\u05d1\u05e8\u05d5\u05ea \u05e0\u05db\u05e9\u05dc\u05d4",
|
||||
"invalid_auth": "\u05d0\u05d9\u05de\u05d5\u05ea \u05dc\u05d0 \u05d7\u05d5\u05e7\u05d9",
|
||||
"too_many_requests": "\u05d1\u05e7\u05e9\u05d5\u05ea \u05e8\u05d1\u05d5\u05ea \u05de\u05d3\u05d9, \u05e0\u05d0 \u05dc\u05e0\u05e1\u05d5\u05ea \u05e9\u05e0\u05d9\u05ea \u05de\u05d0\u05d5\u05d7\u05e8 \u05d9\u05d5\u05ea\u05e8.",
|
||||
"unknown": "\u05e9\u05d2\u05d9\u05d0\u05d4 \u05d1\u05dc\u05ea\u05d9 \u05e6\u05e4\u05d5\u05d9\u05d4"
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"password": "\u05e1\u05d9\u05e1\u05de\u05d4",
|
||||
"username": "\u05e9\u05dd \u05de\u05e9\u05ea\u05de\u05e9"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "A fi\u00f3k m\u00e1r konfigur\u00e1lva van"
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "Sikertelen csatlakoz\u00e1s",
|
||||
"invalid_auth": "\u00c9rv\u00e9nytelen hiteles\u00edt\u00e9s",
|
||||
"too_many_requests": "T\u00fal sok k\u00e9r\u00e9s, pr\u00f3b\u00e1lkozzon k\u00e9s\u0151bb \u00fajra.",
|
||||
"unknown": "V\u00e1ratlan hiba t\u00f6rt\u00e9nt"
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"password": "Jelsz\u00f3",
|
||||
"username": "Felhaszn\u00e1l\u00f3n\u00e9v"
|
||||
},
|
||||
"description": "Adja meg a hiteles\u00edt\u0151 adatait.",
|
||||
"title": "Garmin Csatlakoz\u00e1s"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "Akun sudah dikonfigurasi"
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "Gagal terhubung",
|
||||
"invalid_auth": "Autentikasi tidak valid",
|
||||
"too_many_requests": "Terlalu banyak permintaan, coba lagi nanti.",
|
||||
"unknown": "Kesalahan yang tidak diharapkan"
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"password": "Kata Sandi",
|
||||
"username": "Nama Pengguna"
|
||||
},
|
||||
"description": "Masukkan kredensial Anda.",
|
||||
"title": "Garmin Connect"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "L'account \u00e8 gi\u00e0 configurato"
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "Impossibile connettersi",
|
||||
"invalid_auth": "Autenticazione non valida",
|
||||
"too_many_requests": "Troppe richieste, riprovare pi\u00f9 tardi.",
|
||||
"unknown": "Errore imprevisto"
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"password": "Password",
|
||||
"username": "Nome utente"
|
||||
},
|
||||
"description": "Inserisci le tue credenziali",
|
||||
"title": "Garmin Connect"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "\uacc4\uc815\uc774 \uc774\ubbf8 \uad6c\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4"
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "\uc5f0\uacb0\ud558\uc9c0 \ubabb\ud588\uc2b5\ub2c8\ub2e4",
|
||||
"invalid_auth": "\uc778\uc99d\uc774 \uc798\ubabb\ub418\uc5c8\uc2b5\ub2c8\ub2e4",
|
||||
"too_many_requests": "\uc694\uccad\uc774 \ub108\ubb34 \ub9ce\uc2b5\ub2c8\ub2e4. \ub098\uc911\uc5d0 \ub2e4\uc2dc \uc2dc\ub3c4\ud574\uc8fc\uc138\uc694.",
|
||||
"unknown": "\uc608\uc0c1\uce58 \ubabb\ud55c \uc624\ub958\uac00 \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4"
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"password": "\ube44\ubc00\ubc88\ud638",
|
||||
"username": "\uc0ac\uc6a9\uc790 \uc774\ub984"
|
||||
},
|
||||
"description": "\uc790\uaca9 \uc99d\uba85\uc744 \uc785\ub825\ud574\uc8fc\uc138\uc694",
|
||||
"title": "Garmin Connect"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "Kont ass scho konfigur\u00e9iert"
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "Feeler beim verbannen",
|
||||
"invalid_auth": "Ong\u00eblteg Authentifikatioun",
|
||||
"too_many_requests": "Ze vill Ufroen, prob\u00e9iert sp\u00e9ider nach emol.",
|
||||
"unknown": "Onerwaarte Feeler"
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"password": "Passwuert",
|
||||
"username": "Benotzernumm"
|
||||
},
|
||||
"description": "F\u00ebllt \u00e4r Umeldungs Informatiounen aus.",
|
||||
"title": "Garmin Connect"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"password": "Parole",
|
||||
"username": "Lietot\u0101jv\u0101rds"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "Account is al geconfigureerd"
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "Kan geen verbinding maken",
|
||||
"invalid_auth": "Ongeldige authenticatie",
|
||||
"too_many_requests": "Te veel aanvragen, probeer het later opnieuw.",
|
||||
"unknown": "Onverwachte fout"
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"password": "Wachtwoord",
|
||||
"username": "Gebruikersnaam"
|
||||
},
|
||||
"description": "Voer uw gegevens in",
|
||||
"title": "Garmin Connect"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "Kontoen er allerede konfigurert"
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "Tilkobling mislyktes",
|
||||
"invalid_auth": "Ugyldig godkjenning",
|
||||
"too_many_requests": "For mange foresp\u00f8rsler, pr\u00f8v p\u00e5 nytt senere.",
|
||||
"unknown": "Uventet feil"
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"password": "Passord",
|
||||
"username": "Brukernavn"
|
||||
},
|
||||
"description": "Fyll inn legitimasjonen din.",
|
||||
"title": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "Konto jest ju\u017c skonfigurowane"
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "Nie mo\u017cna nawi\u0105za\u0107 po\u0142\u0105czenia",
|
||||
"invalid_auth": "Niepoprawne uwierzytelnienie",
|
||||
"too_many_requests": "Zbyt wiele \u017c\u0105da\u0144, spr\u00f3buj ponownie p\u00f3\u017aniej",
|
||||
"unknown": "Nieoczekiwany b\u0142\u0105d"
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"password": "Has\u0142o",
|
||||
"username": "Nazwa u\u017cytkownika"
|
||||
},
|
||||
"description": "Wprowad\u017a dane uwierzytelniaj\u0105ce",
|
||||
"title": "Garmin Connect"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"step": {
|
||||
"user": {
|
||||
"description": "Digite suas credenciais.",
|
||||
"title": "Garmin Connect"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "Conta j\u00e1 configurada"
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "Falha na liga\u00e7\u00e3o",
|
||||
"invalid_auth": "Autentica\u00e7\u00e3o inv\u00e1lida",
|
||||
"unknown": "Erro desconhecido"
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"password": "Palavra-passe",
|
||||
"username": "Nome de Utilizador"
|
||||
},
|
||||
"description": "Introduza as suas credenciais.",
|
||||
"title": "Garmin Connect"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "\u042d\u0442\u0430 \u0443\u0447\u0451\u0442\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0443\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u0432 Home Assistant."
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f.",
|
||||
"invalid_auth": "\u041e\u0448\u0438\u0431\u043a\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438.",
|
||||
"too_many_requests": "\u0421\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0443 \u043f\u043e\u0437\u0436\u0435.",
|
||||
"unknown": "\u041d\u0435\u043f\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043d\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430."
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"password": "\u041f\u0430\u0440\u043e\u043b\u044c",
|
||||
"username": "\u0418\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f"
|
||||
},
|
||||
"description": "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0412\u0430\u0448\u0438 \u0443\u0447\u0451\u0442\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435.",
|
||||
"title": "Garmin Connect"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "Účet je už nakonfigurovaný"
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "Nepodarilo sa pripojiť",
|
||||
"invalid_auth": "Neplatné overenie",
|
||||
"too_many_requests": "Príliš veľa žiadostí, skúste to neskôr.",
|
||||
"unknown": "Neočakávaná chyba"
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"password": "Heslo",
|
||||
"username": "Užívateľské meno"
|
||||
},
|
||||
"description": "Zadajte svoje poverovacie údaje.",
|
||||
"title": "Garmin Connect"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "Ta ra\u010dun je \u017ee konfiguriran."
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "Povezava ni uspela, poskusite znova.",
|
||||
"invalid_auth": "Neveljavna avtentikacija.",
|
||||
"too_many_requests": "Preve\u010d zahtev, poskusite pozneje.",
|
||||
"unknown": "Nepri\u010dakovana napaka."
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"password": "Geslo",
|
||||
"username": "Uporabni\u0161ko ime"
|
||||
},
|
||||
"description": "Vnesite svoje poverilnice.",
|
||||
"title": "Garmin Connect"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "Det h\u00e4r kontot har redan konfigurerats."
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "Kunde inte ansluta, var god f\u00f6rs\u00f6k igen.",
|
||||
"invalid_auth": "Ogiltig autentisering.",
|
||||
"too_many_requests": "F\u00f6r m\u00e5nga f\u00f6rfr\u00e5gningar, f\u00f6rs\u00f6k igen senare.",
|
||||
"unknown": "Ov\u00e4ntat fel."
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"password": "L\u00f6senord",
|
||||
"username": "Anv\u00e4ndarnamn"
|
||||
},
|
||||
"description": "Ange dina anv\u00e4ndaruppgifter.",
|
||||
"title": "Garmin Connect"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "Hesap zaten yap\u0131land\u0131r\u0131lm\u0131\u015f"
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "Ba\u011flanma hatas\u0131",
|
||||
"invalid_auth": "Ge\u00e7ersiz kimlik do\u011frulama",
|
||||
"unknown": "Beklenmeyen hata"
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"password": "Parola",
|
||||
"username": "Kullan\u0131c\u0131 Ad\u0131"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "\u0426\u0435\u0439 \u043e\u0431\u043b\u0456\u043a\u043e\u0432\u0438\u0439 \u0437\u0430\u043f\u0438\u0441 \u0432\u0436\u0435 \u0434\u043e\u0434\u0430\u043d\u043e \u0432 Home Assistant."
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "\u041d\u0435 \u0432\u0434\u0430\u043b\u043e\u0441\u044f \u043f\u0456\u0434'\u0454\u0434\u043d\u0430\u0442\u0438\u0441\u044f",
|
||||
"invalid_auth": "\u041d\u0435\u0432\u0456\u0440\u043d\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0456\u043a\u0430\u0446\u0456\u044f.",
|
||||
"too_many_requests": "\u0417\u0430\u043d\u0430\u0434\u0442\u043e \u0431\u0430\u0433\u0430\u0442\u043e \u0437\u0430\u043f\u0438\u0442\u0456\u0432, \u0441\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0449\u0435 \u0440\u0430\u0437 \u043f\u0456\u0437\u043d\u0456\u0448\u0435.",
|
||||
"unknown": "\u041d\u0435\u043e\u0447\u0456\u043a\u0443\u0432\u0430\u043d\u0430 \u043f\u043e\u043c\u0438\u043b\u043a\u0430"
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"password": "\u041f\u0430\u0440\u043e\u043b\u044c",
|
||||
"username": "\u0406\u043c'\u044f \u043a\u043e\u0440\u0438\u0441\u0442\u0443\u0432\u0430\u0447\u0430"
|
||||
},
|
||||
"description": "\u0412\u0432\u0435\u0434\u0456\u0442\u044c \u0412\u0430\u0448\u0456 \u043e\u0431\u043b\u0456\u043a\u043e\u0432\u0456 \u0434\u0430\u043d\u0456.",
|
||||
"title": "Garmin Connect"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"username": "\u7528\u6237\u540d"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "\u5e33\u865f\u5df2\u7d93\u8a2d\u5b9a\u5b8c\u6210"
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "\u9023\u7dda\u5931\u6557",
|
||||
"invalid_auth": "\u9a57\u8b49\u78bc\u7121\u6548",
|
||||
"too_many_requests": "\u8acb\u6c42\u6b21\u6578\u904e\u591a\uff0c\u8acb\u7a0d\u5f8c\u91cd\u8a66\u3002",
|
||||
"unknown": "\u672a\u9810\u671f\u932f\u8aa4"
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"password": "\u5bc6\u78bc",
|
||||
"username": "\u4f7f\u7528\u8005\u540d\u7a31"
|
||||
},
|
||||
"description": "\u8f38\u5165\u6191\u8b49\u3002",
|
||||
"title": "Garmin Connect"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Garmin Connect",
|
||||
"render_readme": true,
|
||||
"homeassistant": "2024.4.1",
|
||||
"homeassistant": "2025.1.4",
|
||||
"hacs": "1.34.0"
|
||||
}
|
||||
@@ -1,2 +1,2 @@
|
||||
colorlog==6.9.0
|
||||
setuptools==75.8.0
|
||||
colorlog==6.10.1
|
||||
setuptools==80.9.0
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
# homeassistant==2024.4.1
|
||||
homeassistant==2025.1.2
|
||||
homeassistant==2025.1.4
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--requirement requirements_base.txt
|
||||
codespell==2.3.0
|
||||
isort==5.13.2
|
||||
pre-commit==4.0.1
|
||||
pre-commit-hooks==5.0.0
|
||||
pyupgrade==3.19.1
|
||||
ruff==0.9.2
|
||||
codespell==2.4.1
|
||||
isort==7.0.0
|
||||
pre-commit==4.3.0
|
||||
pre-commit-hooks==6.0.0
|
||||
pyupgrade==3.21.0
|
||||
ruff==0.14.3
|
||||
vulture==2.14
|
||||
|
||||
Reference in New Issue
Block a user