diff --git a/homeassistant/components/withings/sensor.py b/homeassistant/components/withings/sensor.py index 9d91f96669f4..1d2af9dbdc14 100644 --- a/homeassistant/components/withings/sensor.py +++ b/homeassistant/components/withings/sensor.py @@ -238,6 +238,13 @@ MEASUREMENT_SENSORS: dict[ state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, ), + MeasurementType.METABOLIC_AGE: WithingsMeasurementSensorEntityDescription( + key="metabolic_age", + measurement_type=MeasurementType.METABOLIC_AGE, + translation_key="metabolic_age", + state_class=SensorStateClass.MEASUREMENT, + entity_registry_enabled_default=False, + ), MeasurementType.VISCERAL_FAT: WithingsMeasurementSensorEntityDescription( key="visceral_fat", measurement_type=MeasurementType.VISCERAL_FAT, diff --git a/homeassistant/components/withings/strings.json b/homeassistant/components/withings/strings.json index 80aefe031c3b..d7db538a36b8 100644 --- a/homeassistant/components/withings/strings.json +++ b/homeassistant/components/withings/strings.json @@ -180,6 +180,9 @@ "maximum_respiratory_rate": { "name": "Maximum respiratory rate" }, + "metabolic_age": { + "name": "Metabolic age" + }, "minimum_heart_rate": { "name": "Minimum heart rate" }, diff --git a/tests/components/withings/fixtures/measurements.json b/tests/components/withings/fixtures/measurements.json index 5ce14b6c7749..c70e1952f46e 100644 --- a/tests/components/withings/fixtures/measurements.json +++ b/tests/components/withings/fixtures/measurements.json @@ -550,6 +550,13 @@ "fm": 3, "position": 7 }, + { + "value": 31, + "type": 227, + "unit": 0, + "algo": 218235904, + "fm": 3 + }, { "value": 19467, "type": 6, @@ -793,6 +800,13 @@ "fm": 3, "position": 7 }, + { + "value": 32, + "type": 227, + "unit": 0, + "algo": 218235904, + "fm": 3 + }, { "value": 18457, "type": 6, diff --git a/tests/components/withings/snapshots/test_diagnostics.ambr b/tests/components/withings/snapshots/test_diagnostics.ambr index bfd56fbc4d47..aa84b7e3720c 100644 --- a/tests/components/withings/snapshots/test_diagnostics.ambr +++ b/tests/components/withings/snapshots/test_diagnostics.ambr @@ -28,6 +28,7 @@ 'intracellular_water', 'visceral_fat', 'basal_metabolic_rate', + 'metabolic_age', 'fat_ratio', 'height', 'temperature', @@ -103,6 +104,7 @@ 'intracellular_water', 'visceral_fat', 'basal_metabolic_rate', + 'metabolic_age', 'fat_ratio', 'height', 'temperature', @@ -178,6 +180,7 @@ 'intracellular_water', 'visceral_fat', 'basal_metabolic_rate', + 'metabolic_age', 'fat_ratio', 'height', 'temperature', diff --git a/tests/components/withings/snapshots/test_sensor.ambr b/tests/components/withings/snapshots/test_sensor.ambr index 42f66c905021..5375a75de6b4 100644 --- a/tests/components/withings/snapshots/test_sensor.ambr +++ b/tests/components/withings/snapshots/test_sensor.ambr @@ -2607,6 +2607,59 @@ 'state': '20', }) # --- +# name: test_all_entities[sensor.henk_metabolic_age-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : , + }), + 'config_entry_id': , + 'config_subentry_id': None, + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.henk_metabolic_age', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Metabolic age', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Metabolic age', + 'platform': 'withings', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'metabolic_age', + 'unique_id': 'withings_12345_metabolic_age', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[sensor.henk_metabolic_age-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'henk Metabolic age', + : , + }), + 'context': , + 'entity_id': 'sensor.henk_metabolic_age', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '32', + }) +# --- # name: test_all_entities[sensor.henk_minimum_heart_rate-entry] EntityRegistryEntrySnapshot({ 'aliases': list([