mirror of
https://github.com/cyberjunky/home-assistant-garmin_connect.git
synced 2026-01-09 12:57:58 -05:00
Add service for body composition
Relates to https://github.com/cyberjunky/home-assistant-garmin_connect/issues/74
This commit is contained in:
@@ -101,6 +101,9 @@ async def async_setup_entry(
|
||||
"set_active_gear", ENTITY_SERVICE_SCHEMA, coordinator.set_active_gear
|
||||
)
|
||||
|
||||
platform.async_register_entity_service(
|
||||
"add_body_composition", BODY_COMPOSITION_SERVICE_SCHEMA, coordinator.add_body_composition
|
||||
)
|
||||
|
||||
ENTITY_SERVICE_SCHEMA = vol.Schema(
|
||||
{
|
||||
@@ -110,6 +113,24 @@ ENTITY_SERVICE_SCHEMA = vol.Schema(
|
||||
}
|
||||
)
|
||||
|
||||
BODY_COMPOSITION_SERVICE_SCHEMA = vol.Schema(
|
||||
{
|
||||
vol.Required(ATTR_ENTITY_ID): str,
|
||||
vol.Optional("timestamp"): str,
|
||||
vol.Required("weight"): float,
|
||||
vol.Optional("percent_fat"): float,
|
||||
vol.Optional("percent_hydration"): float,
|
||||
vol.Optional("visceral_fat_mass"): float,
|
||||
vol.Optional("bone_mass"): float,
|
||||
vol.Optional("muscle_mass"): float,
|
||||
vol.Optional("basal_met"): float,
|
||||
vol.Optional("active_met"): float,
|
||||
vol.Optional("physique_rating"): float,
|
||||
vol.Optional("metabolic_age"): float,
|
||||
vol.Optional("visceral_fat_rating"): float,
|
||||
vol.Optional("bmi"): float
|
||||
}
|
||||
)
|
||||
|
||||
class GarminConnectSensor(CoordinatorEntity, SensorEntity):
|
||||
"""Representation of a Garmin Connect Sensor."""
|
||||
|
||||
Reference in New Issue
Block a user