Skip to content

Commit

Permalink
Bump aiowithings to 2.0.0 (home-assistant#104579)
Browse files Browse the repository at this point in the history
  • Loading branch information
joostlek authored Nov 27, 2023
1 parent 9907e11 commit ccc8804
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 43 deletions.
2 changes: 1 addition & 1 deletion homeassistant/components/withings/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"iot_class": "cloud_push",
"loggers": ["aiowithings"],
"quality_scale": "platinum",
"requirements": ["aiowithings==1.0.3"]
"requirements": ["aiowithings==2.0.0"]
}
14 changes: 8 additions & 6 deletions homeassistant/components/withings/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,10 +424,11 @@ class WithingsActivitySensorEntityDescription(SensorEntityDescription):
),
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(
Expand Down Expand Up @@ -568,10 +569,11 @@ class WithingsWorkoutSensorEntityDescription(SensorEntityDescription):
),
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",
Expand Down
8 changes: 4 additions & 4 deletions homeassistant/components/withings/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
62 changes: 32 additions & 30 deletions tests/components/withings/snapshots/test_sensor.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -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': <UnitOfLength.METERS: 'm'>,
}),
'context': <ANY>,
'entity_id': 'sensor.henk_elevation_change_last_workout',
'last_changed': <ANY>,
'last_updated': <ANY>,
'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': <SensorStateClass.TOTAL: 'total'>,
'unit_of_measurement': <UnitOfLength.METERS: 'm'>,
}),
'context': <ANY>,
'entity_id': 'sensor.henk_elevation_change_today',
'last_changed': <ANY>,
'last_updated': <ANY>,
'state': '0',
})
# ---
# name: test_all_entities[sensor.henk_extracellular_water]
StateSnapshot({
'attributes': ReadOnlyDict({
Expand Down Expand Up @@ -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': <ANY>,
'entity_id': 'sensor.henk_floors_climbed_last_workout',
'last_changed': <ANY>,
'last_updated': <ANY>,
'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': <SensorStateClass.TOTAL: 'total'>,
'unit_of_measurement': 'floors',
}),
'context': <ANY>,
'entity_id': 'sensor.henk_floors_climbed_today',
'last_changed': <ANY>,
'last_updated': <ANY>,
'state': '0',
})
# ---
# name: test_all_entities[sensor.henk_heart_pulse]
StateSnapshot({
'attributes': ReadOnlyDict({
Expand Down

0 comments on commit ccc8804

Please sign in to comment.