Documented services examples

This commit is contained in:
Ron Klinkien
2025-01-21 08:11:52 +00:00
parent 2eeb42b4da
commit 164fc53b6d
3 changed files with 73 additions and 19 deletions

View File

@@ -89,6 +89,7 @@ Gear Sensors
Disabled by default: Disabled by default:
```text ```text
Badges
Consumed KiloCalories Consumed KiloCalories
Remaining KiloCalories Remaining KiloCalories
Net Remaining KiloCalories Net Remaining KiloCalories
@@ -151,20 +152,20 @@ description: ""
trigger: trigger:
- platform: state - platform: state
entity_id: entity_id:
- sensor.my_weight - sensor.weight
condition: condition:
- condition: and - condition: and
conditions: conditions:
- condition: numeric_state - condition: numeric_state
entity_id: sensor.my_weight entity_id: sensor.weight
above: 75 above: 75
- condition: numeric_state - condition: numeric_state
entity_id: sensor.my_weight entity_id: sensor.weight
below: 88 below: 88
action: action:
- service: garmin_connect.add_body_composition - service: garmin_connect.add_body_composition
data: data:
entity_id: sensor.garmin_connect_weight entity_id: sensor.weight
weight: "{{trigger.to_state.state}}" weight: "{{trigger.to_state.state}}"
timestamp: "{{ as_timestamp(now()) | timestamp_local}}" timestamp: "{{ as_timestamp(now()) | timestamp_local}}"
bmi: >- bmi: >-
@@ -172,6 +173,46 @@ action:
}} }}
mode: single mode: single
``` ```
### Examples on how to test services from HA GUI
#### Add Body Composition
```
action: garmin_connect.add_body_composition
data:
entity_id: sensor.weight
weight: 87
bmi: 25.5
bone_mass: 4.8
...
```
NOTE: You need to enable Weight entity
#### Set Active Gear
```
action: garmin_connect.set_active_gear
data:
entity_id: sensor.adidas
activity_type: running
setting: set as default
```
#### Add Blood Pressure
```
action: garmin_connect.add_blood_pressure
data:
entity_id: sensor.min_heart_rate
systolic: 120
diastolic: 80
pulse: 60
timestamp: 2025-1-21T07:34:00.000Z
notes: Measured with Beurer BC54
```
## Debugging ## Debugging
Add the relevant lines below to the `configuration.yaml`: Add the relevant lines below to the `configuration.yaml`:

View File

@@ -23,6 +23,19 @@ DAY_TO_NUMBER = {
"Su": 7, "Su": 7,
} }
LEVEL_POINTS = {
1: 0,
2: 20,
3: 60,
4: 140,
5: 300,
6: 620,
7: 1260,
8: 2540,
9: 5100,
10: 10220,
}
GARMIN_ENTITY_LIST = { GARMIN_ENTITY_LIST = {
"totalSteps": ["Total Steps", "steps", "mdi:walk", None, SensorStateClass.TOTAL, True], "totalSteps": ["Total Steps", "steps", "mdi:walk", None, SensorStateClass.TOTAL, True],
"dailyStepGoal": ["Daily Step Goal", "steps", "mdi:walk", None, SensorStateClass.TOTAL, True], "dailyStepGoal": ["Daily Step Goal", "steps", "mdi:walk", None, SensorStateClass.TOTAL, True],

View File

@@ -2,6 +2,14 @@ set_active_gear:
name: Set active gear for activity name: Set active gear for activity
description: Set active gear for activity. description: Set active gear for activity.
fields: fields:
entity_id:
name: entity
description: entity
required: true
selector:
entity:
integration: garmin_connect
device_class: garmin_gear
activity_type: activity_type:
required: true required: true
name: activity type name: activity type
@@ -28,6 +36,11 @@ set_active_gear:
- set this as default, unset others - set this as default, unset others
- set as default - set as default
- unset default - unset default
add_body_composition:
name: Adds updated body composition metrics
description: Adds updated body composition metrics.
fields:
entity_id: entity_id:
name: entity name: entity
description: entity description: entity
@@ -35,12 +48,7 @@ set_active_gear:
selector: selector:
entity: entity:
integration: garmin_connect integration: garmin_connect
device_class: garmin_gear device_class: weight
add_body_composition:
name: Adds updated body composition metrics
description: Adds updated body composition metrics.
fields:
weight: weight:
required: true required: true
name: Weight name: Weight
@@ -106,14 +114,6 @@ add_body_composition:
name: Visceral Fat Rating name: Visceral Fat Rating
description: Visceral Fat Rating description: Visceral Fat Rating
example: 10 example: 10
entity_id:
name: entity
description: entity
required: true
selector:
entity:
integration: garmin_connect
device_class: weight
add_blood_pressure: add_blood_pressure:
name: Adds updated blood pressure metrics name: Adds updated blood pressure metrics
@@ -126,7 +126,7 @@ add_blood_pressure:
selector: selector:
entity: entity:
integration: garmin_connect integration: garmin_connect
device_class: weight device_class: min_heart_rate
systolic: systolic:
required: true required: true
name: Systolic name: Systolic