From 7c151657b70519dbc799eac2fad18b204026ccfc Mon Sep 17 00:00:00 2001 From: Matthieu Huguet Date: Sat, 30 Mar 2024 00:09:00 +0100 Subject: [PATCH 1/2] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20bump=20homeassistant?= =?UTF-8?q?=20from=202023.8.0=20to=202024.3.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 ++++ requirements.txt | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 623c768..491275a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Changed + +- upgrade homeassistant to 2024.3.3 + ## [0.1.0] - 2024-03-29 ### Added diff --git a/requirements.txt b/requirements.txt index 83a426b..e917986 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ colorlog==6.8.2 -homeassistant==2023.8.0 +homeassistant==2024.3.3 pip==24.0 ruff==0.3.4 ph4-walkingpad==0.0.7 From 8ed13a8052388b450801db2404765915eb018248 Mon Sep 17 00:00:00 2001 From: Matthieu Huguet Date: Sat, 30 Mar 2024 00:10:16 +0100 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=90=9B=20fix=20warning=20about=20inva?= =?UTF-8?q?lid=20suggested=5Funit=5Fof=5Fmeasurement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some walkingpad sensors are generating warnings in the logs: > sets > an invalid suggested_unit_of_measurement. Please create a bug > report at https://github.com/madmatah/hass-walkingpad/issues. This > warning will become an error in Home Assistant Core 2024.5 Since the specified suggested_unit_of_measurements specified in the sensors definition do not differ from their native_unit_of_measurements, I don't think that they are very useful. So I removed them. --- CHANGELOG.md | 4 ++++ custom_components/king_smith/sensor.py | 5 ----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 491275a..c128207 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ Versioning](https://semver.org/spec/v2.0.0.html). - upgrade homeassistant to 2024.3.3 +### Fixed + +- warnings about invalid suggested_unit_of_measurement + ## [0.1.0] - 2024-03-29 ### Added diff --git a/custom_components/king_smith/sensor.py b/custom_components/king_smith/sensor.py index 1ff8a74..b1944aa 100644 --- a/custom_components/king_smith/sensor.py +++ b/custom_components/king_smith/sensor.py @@ -38,7 +38,6 @@ class WalkingPadSensorEntityDescription(SensorEntityDescription): native_unit_of_measurement=UnitOfLength.KILOMETERS, state_class=SensorStateClass.TOTAL_INCREASING, suggested_display_precision=2, - suggested_unit_of_measurement=UnitOfLength.KILOMETERS, translation_key="walkingpad_distance", value_fn=lambda status: status.get("session_distance", 0.0) / 1000, ), @@ -59,7 +58,6 @@ class WalkingPadSensorEntityDescription(SensorEntityDescription): native_unit_of_measurement=UnitOfTime.MINUTES, state_class=SensorStateClass.TOTAL_INCREASING, suggested_display_precision=0, - suggested_unit_of_measurement=UnitOfTime.MINUTES, translation_key="walkingpad_duration_minutes", value_fn=lambda status: round(status.get("session_running_time", 0) / 60, 1), ), @@ -70,7 +68,6 @@ class WalkingPadSensorEntityDescription(SensorEntityDescription): native_unit_of_measurement=UnitOfTime.HOURS, state_class=SensorStateClass.TOTAL_INCREASING, suggested_display_precision=1, - suggested_unit_of_measurement=UnitOfTime.HOURS, translation_key="walkingpad_duration_hours", value_fn=lambda status: round(status.get("session_running_time", 0) / 3600, 4), ), @@ -81,7 +78,6 @@ class WalkingPadSensorEntityDescription(SensorEntityDescription): native_unit_of_measurement=UnitOfTime.DAYS, state_class=SensorStateClass.TOTAL_INCREASING, suggested_display_precision=1, - suggested_unit_of_measurement=UnitOfTime.DAYS, translation_key="walkingpad_duration_days", value_fn=lambda status: round(status.get("session_running_time", 0) / 86400, 6), ), @@ -93,7 +89,6 @@ class WalkingPadSensorEntityDescription(SensorEntityDescription): native_unit_of_measurement=UnitOfSpeed.KILOMETERS_PER_HOUR, state_class=SensorStateClass.MEASUREMENT, suggested_display_precision=1, - suggested_unit_of_measurement=UnitOfSpeed.KILOMETERS_PER_HOUR, translation_key="walkingpad_current_speed", value_fn=lambda status: status.get("speed", 0.0), ),