diff --git a/homeassistant/components/withings/manifest.json b/homeassistant/components/withings/manifest.json index e2357e78fb8..fe5704d119c 100644 --- a/homeassistant/components/withings/manifest.json +++ b/homeassistant/components/withings/manifest.json @@ -9,5 +9,5 @@ "iot_class": "cloud_push", "loggers": ["aiowithings"], "quality_scale": "platinum", - "requirements": ["aiowithings==1.0.3"] + "requirements": ["aiowithings==2.0.0"] } diff --git a/homeassistant/components/withings/sensor.py b/homeassistant/components/withings/sensor.py index b7ef6c6852b..36ac9ea7d73 100644 --- a/homeassistant/components/withings/sensor.py +++ b/homeassistant/components/withings/sensor.py @@ -424,10 +424,11 @@ ACTIVITY_SENSORS = [ ), WithingsActivitySensorEntityDescription( key="activity_floors_climbed_today", - value_fn=lambda activity: activity.floors_climbed, - translation_key="activity_floors_climbed_today", + value_fn=lambda activity: activity.elevation, + translation_key="activity_elevation_today", icon="mdi:stairs-up", - native_unit_of_measurement="floors", + native_unit_of_measurement=UnitOfLength.METERS, + device_class=SensorDeviceClass.DISTANCE, state_class=SensorStateClass.TOTAL, ), WithingsActivitySensorEntityDescription( @@ -568,10 +569,11 @@ WORKOUT_SENSORS = [ ), WithingsWorkoutSensorEntityDescription( key="workout_floors_climbed", - value_fn=lambda workout: workout.floors_climbed, - translation_key="workout_floors_climbed", + value_fn=lambda workout: workout.elevation, + translation_key="workout_elevation", icon="mdi:stairs-up", - native_unit_of_measurement="floors", + native_unit_of_measurement=UnitOfLength.METERS, + device_class=SensorDeviceClass.DISTANCE, ), WithingsWorkoutSensorEntityDescription( key="workout_intensity", diff --git a/homeassistant/components/withings/strings.json b/homeassistant/components/withings/strings.json index fc24c1f5325..ffbbd9acc2b 100644 --- a/homeassistant/components/withings/strings.json +++ b/homeassistant/components/withings/strings.json @@ -158,8 +158,8 @@ "activity_distance_today": { "name": "Distance travelled today" }, - "activity_floors_climbed_today": { - "name": "Floors climbed today" + "activity_elevation_today": { + "name": "Elevation change today" }, "activity_soft_duration_today": { "name": "Soft activity today" @@ -239,8 +239,8 @@ "workout_distance": { "name": "Distance travelled last workout" }, - "workout_floors_climbed": { - "name": "Floors climbed last workout" + "workout_elevation": { + "name": "Elevation change last workout" }, "workout_intensity": { "name": "Last workout intensity" diff --git a/requirements_all.txt b/requirements_all.txt index 3d2d44add3c..45cd6999f2d 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -392,7 +392,7 @@ aiowatttime==0.1.1 aiowebostv==0.3.3 # homeassistant.components.withings -aiowithings==1.0.3 +aiowithings==2.0.0 # homeassistant.components.yandex_transport aioymaps==1.2.2 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index f3bd472c386..a70c14781a8 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -365,7 +365,7 @@ aiowatttime==0.1.1 aiowebostv==0.3.3 # homeassistant.components.withings -aiowithings==1.0.3 +aiowithings==2.0.0 # homeassistant.components.yandex_transport aioymaps==1.2.2 diff --git a/tests/components/withings/snapshots/test_sensor.ambr b/tests/components/withings/snapshots/test_sensor.ambr index 59d9b470247..4ca4093e3b8 100644 --- a/tests/components/withings/snapshots/test_sensor.ambr +++ b/tests/components/withings/snapshots/test_sensor.ambr @@ -178,6 +178,38 @@ 'state': '1020.121', }) # --- +# name: test_all_entities[sensor.henk_elevation_change_last_workout] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'distance', + 'friendly_name': 'henk Elevation change last workout', + 'icon': 'mdi:stairs-up', + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'sensor.henk_elevation_change_last_workout', + 'last_changed': , + 'last_updated': , + 'state': '4', + }) +# --- +# name: test_all_entities[sensor.henk_elevation_change_today] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'distance', + 'friendly_name': 'henk Elevation change today', + 'icon': 'mdi:stairs-up', + 'last_reset': '2023-10-20T00:00:00-07:00', + 'state_class': , + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'sensor.henk_elevation_change_today', + 'last_changed': , + 'last_updated': , + 'state': '0', + }) +# --- # name: test_all_entities[sensor.henk_extracellular_water] StateSnapshot({ 'attributes': ReadOnlyDict({ @@ -237,36 +269,6 @@ 'state': '0.07', }) # --- -# name: test_all_entities[sensor.henk_floors_climbed_last_workout] - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'friendly_name': 'henk Floors climbed last workout', - 'icon': 'mdi:stairs-up', - 'unit_of_measurement': 'floors', - }), - 'context': , - 'entity_id': 'sensor.henk_floors_climbed_last_workout', - 'last_changed': , - 'last_updated': , - 'state': '4', - }) -# --- -# name: test_all_entities[sensor.henk_floors_climbed_today] - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'friendly_name': 'henk Floors climbed today', - 'icon': 'mdi:stairs-up', - 'last_reset': '2023-10-20T00:00:00-07:00', - 'state_class': , - 'unit_of_measurement': 'floors', - }), - 'context': , - 'entity_id': 'sensor.henk_floors_climbed_today', - 'last_changed': , - 'last_updated': , - 'state': '0', - }) -# --- # name: test_all_entities[sensor.henk_heart_pulse] StateSnapshot({ 'attributes': ReadOnlyDict({