diff --git a/homeassistant/components/aosmith/manifest.json b/homeassistant/components/aosmith/manifest.json index 21580b87286..4cd1eb32cd1 100644 --- a/homeassistant/components/aosmith/manifest.json +++ b/homeassistant/components/aosmith/manifest.json @@ -5,5 +5,5 @@ "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/aosmith", "iot_class": "cloud_polling", - "requirements": ["py-aosmith==1.0.8"] + "requirements": ["py-aosmith==1.0.10"] } diff --git a/homeassistant/components/aosmith/sensor.py b/homeassistant/components/aosmith/sensor.py index 89b383744e5..b1c9852f647 100644 --- a/homeassistant/components/aosmith/sensor.py +++ b/homeassistant/components/aosmith/sensor.py @@ -3,7 +3,7 @@ from collections.abc import Callable from dataclasses import dataclass -from py_aosmith.models import Device as AOSmithDevice, HotWaterStatus +from py_aosmith.models import Device as AOSmithDevice from homeassistant.components.sensor import ( SensorDeviceClass, @@ -11,7 +11,7 @@ from homeassistant.components.sensor import ( SensorEntityDescription, SensorStateClass, ) -from homeassistant.const import UnitOfEnergy +from homeassistant.const import PERCENTAGE, UnitOfEnergy from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitiesCallback @@ -31,20 +31,11 @@ STATUS_ENTITY_DESCRIPTIONS: tuple[AOSmithStatusSensorEntityDescription, ...] = ( AOSmithStatusSensorEntityDescription( key="hot_water_availability", translation_key="hot_water_availability", - device_class=SensorDeviceClass.ENUM, - options=["low", "medium", "high"], - value_fn=lambda device: HOT_WATER_STATUS_MAP.get( - device.status.hot_water_status - ), + native_unit_of_measurement=PERCENTAGE, + value_fn=lambda device: device.status.hot_water_status, ), ) -HOT_WATER_STATUS_MAP: dict[HotWaterStatus, str] = { - HotWaterStatus.LOW: "low", - HotWaterStatus.MEDIUM: "medium", - HotWaterStatus.HIGH: "high", -} - async def async_setup_entry( hass: HomeAssistant, diff --git a/homeassistant/components/aosmith/strings.json b/homeassistant/components/aosmith/strings.json index 0ca4e2e9094..c88b9cab783 100644 --- a/homeassistant/components/aosmith/strings.json +++ b/homeassistant/components/aosmith/strings.json @@ -28,12 +28,7 @@ "entity": { "sensor": { "hot_water_availability": { - "name": "Hot water availability", - "state": { - "low": "Low", - "medium": "Medium", - "high": "High" - } + "name": "Hot water availability" }, "energy_usage": { "name": "Energy usage" diff --git a/requirements_all.txt b/requirements_all.txt index 1bcba221221..51f1ca54358 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1662,7 +1662,7 @@ pushover_complete==1.1.1 pvo==2.1.1 # homeassistant.components.aosmith -py-aosmith==1.0.8 +py-aosmith==1.0.10 # homeassistant.components.canary py-canary==0.5.4 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index ef2a61191ed..484b6a8705e 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1357,7 +1357,7 @@ pushover_complete==1.1.1 pvo==2.1.1 # homeassistant.components.aosmith -py-aosmith==1.0.8 +py-aosmith==1.0.10 # homeassistant.components.canary py-canary==0.5.4 diff --git a/tests/components/aosmith/conftest.py b/tests/components/aosmith/conftest.py index 7efbe0c58b2..31e36332a89 100644 --- a/tests/components/aosmith/conftest.py +++ b/tests/components/aosmith/conftest.py @@ -10,7 +10,6 @@ from py_aosmith.models import ( DeviceType, EnergyUseData, EnergyUseHistoryEntry, - HotWaterStatus, OperationMode, SupportedOperationModeInfo, ) @@ -93,7 +92,7 @@ def build_device_fixture( temperature_setpoint_pending=setpoint_pending, temperature_setpoint_previous=130, temperature_setpoint_maximum=130, - hot_water_status=HotWaterStatus.LOW, + hot_water_status=90, ), ) diff --git a/tests/components/aosmith/fixtures/get_all_device_info.json b/tests/components/aosmith/fixtures/get_all_device_info.json index 4d19a80a3ad..27bd5b24a16 100644 --- a/tests/components/aosmith/fixtures/get_all_device_info.json +++ b/tests/components/aosmith/fixtures/get_all_device_info.json @@ -103,7 +103,7 @@ } ], "firmwareVersion": "2.14", - "hotWaterStatus": "HIGH", + "hotWaterStatus": 10, "isAdvancedLoadUpMore": false, "isCtaUcmPresent": false, "isDemandResponsePaused": false, diff --git a/tests/components/aosmith/snapshots/test_diagnostics.ambr b/tests/components/aosmith/snapshots/test_diagnostics.ambr index 8704cdaa214..e2cf6c6b24b 100644 --- a/tests/components/aosmith/snapshots/test_diagnostics.ambr +++ b/tests/components/aosmith/snapshots/test_diagnostics.ambr @@ -43,7 +43,7 @@ 'error': '', 'firmwareVersion': '2.14', 'heaterSsid': '**REDACTED**', - 'hotWaterStatus': 'HIGH', + 'hotWaterStatus': 10, 'isAdvancedLoadUpMore': False, 'isCtaUcmPresent': False, 'isDemandResponsePaused': False, diff --git a/tests/components/aosmith/snapshots/test_sensor.ambr b/tests/components/aosmith/snapshots/test_sensor.ambr index 7aae9713037..563b52f6df7 100644 --- a/tests/components/aosmith/snapshots/test_sensor.ambr +++ b/tests/components/aosmith/snapshots/test_sensor.ambr @@ -58,13 +58,7 @@ 'aliases': set({ }), 'area_id': None, - 'capabilities': dict({ - 'options': list([ - 'low', - 'medium', - 'high', - ]), - }), + 'capabilities': None, 'config_entry_id': , 'device_class': None, 'device_id': , @@ -81,7 +75,7 @@ 'name': None, 'options': dict({ }), - 'original_device_class': , + 'original_device_class': None, 'original_icon': None, 'original_name': 'Hot water availability', 'platform': 'aosmith', @@ -89,25 +83,20 @@ 'supported_features': 0, 'translation_key': 'hot_water_availability', 'unique_id': 'hot_water_availability_junctionId', - 'unit_of_measurement': None, + 'unit_of_measurement': '%', }) # --- # name: test_state[sensor.my_water_heater_hot_water_availability-state] StateSnapshot({ 'attributes': ReadOnlyDict({ - 'device_class': 'enum', 'friendly_name': 'My water heater Hot water availability', - 'options': list([ - 'low', - 'medium', - 'high', - ]), + 'unit_of_measurement': '%', }), 'context': , 'entity_id': 'sensor.my_water_heater_hot_water_availability', 'last_changed': , 'last_reported': , 'last_updated': , - 'state': 'low', + 'state': '90', }) # ---