From 485f3b0f0af1156951858c2da01e486f24d9c727 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Mon, 6 May 2024 19:09:02 +0200 Subject: [PATCH] Set pH device class in Ondilo Ico (#116930) --- homeassistant/components/ondilo_ico/icons.json | 3 --- homeassistant/components/ondilo_ico/sensor.py | 2 +- homeassistant/components/ondilo_ico/strings.json | 3 --- tests/components/ondilo_ico/snapshots/test_sensor.ambr | 10 ++++++---- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/homeassistant/components/ondilo_ico/icons.json b/homeassistant/components/ondilo_ico/icons.json index 9319b747b28..20ef842ed4d 100644 --- a/homeassistant/components/ondilo_ico/icons.json +++ b/homeassistant/components/ondilo_ico/icons.json @@ -4,9 +4,6 @@ "oxydo_reduction_potential": { "default": "mdi:pool" }, - "ph": { - "default": "mdi:pool" - }, "tds": { "default": "mdi:pool" }, diff --git a/homeassistant/components/ondilo_ico/sensor.py b/homeassistant/components/ondilo_ico/sensor.py index 5f21fb6a909..8a3dc3c3937 100644 --- a/homeassistant/components/ondilo_ico/sensor.py +++ b/homeassistant/components/ondilo_ico/sensor.py @@ -38,7 +38,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = ( ), SensorEntityDescription( key="ph", - translation_key="ph", + device_class=SensorDeviceClass.PH, state_class=SensorStateClass.MEASUREMENT, ), SensorEntityDescription( diff --git a/homeassistant/components/ondilo_ico/strings.json b/homeassistant/components/ondilo_ico/strings.json index 26199b1bd75..360c0b124a7 100644 --- a/homeassistant/components/ondilo_ico/strings.json +++ b/homeassistant/components/ondilo_ico/strings.json @@ -22,9 +22,6 @@ "oxydo_reduction_potential": { "name": "Oxydo reduction potential" }, - "ph": { - "name": "pH" - }, "tds": { "name": "TDS" }, diff --git a/tests/components/ondilo_ico/snapshots/test_sensor.ambr b/tests/components/ondilo_ico/snapshots/test_sensor.ambr index e55b030e820..56e30cd904a 100644 --- a/tests/components/ondilo_ico/snapshots/test_sensor.ambr +++ b/tests/components/ondilo_ico/snapshots/test_sensor.ambr @@ -124,13 +124,13 @@ 'name': None, 'options': dict({ }), - 'original_device_class': None, + 'original_device_class': , 'original_icon': None, 'original_name': 'pH', 'platform': 'ondilo_ico', 'previous_unique_id': None, 'supported_features': 0, - 'translation_key': 'ph', + 'translation_key': None, 'unique_id': 'W1122333044455-ph', 'unit_of_measurement': None, }) @@ -138,6 +138,7 @@ # name: test_sensors[sensor.pool_1_ph-state] StateSnapshot({ 'attributes': ReadOnlyDict({ + 'device_class': 'ph', 'friendly_name': 'Pool 1 pH', 'state_class': , }), @@ -475,13 +476,13 @@ 'name': None, 'options': dict({ }), - 'original_device_class': None, + 'original_device_class': , 'original_icon': None, 'original_name': 'pH', 'platform': 'ondilo_ico', 'previous_unique_id': None, 'supported_features': 0, - 'translation_key': 'ph', + 'translation_key': None, 'unique_id': 'W2233304445566-ph', 'unit_of_measurement': None, }) @@ -489,6 +490,7 @@ # name: test_sensors[sensor.pool_2_ph-state] StateSnapshot({ 'attributes': ReadOnlyDict({ + 'device_class': 'ph', 'friendly_name': 'Pool 2 pH', 'state_class': , }),