Update A. O. Smith integration to reflect upstream API changes (#127678)
This commit is contained in:
parent
3cda93d001
commit
b4dfd08bc4
9 changed files with 16 additions and 42 deletions
|
@ -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"]
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
),
|
||||
)
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
}
|
||||
],
|
||||
"firmwareVersion": "2.14",
|
||||
"hotWaterStatus": "HIGH",
|
||||
"hotWaterStatus": 10,
|
||||
"isAdvancedLoadUpMore": false,
|
||||
"isCtaUcmPresent": false,
|
||||
"isDemandResponsePaused": false,
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
'error': '',
|
||||
'firmwareVersion': '2.14',
|
||||
'heaterSsid': '**REDACTED**',
|
||||
'hotWaterStatus': 'HIGH',
|
||||
'hotWaterStatus': 10,
|
||||
'isAdvancedLoadUpMore': False,
|
||||
'isCtaUcmPresent': False,
|
||||
'isDemandResponsePaused': False,
|
||||
|
|
|
@ -58,13 +58,7 @@
|
|||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'options': list([
|
||||
'low',
|
||||
'medium',
|
||||
'high',
|
||||
]),
|
||||
}),
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
|
@ -81,7 +75,7 @@
|
|||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.ENUM: 'enum'>,
|
||||
'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': <ANY>,
|
||||
'entity_id': 'sensor.my_water_heater_hot_water_availability',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'low',
|
||||
'state': '90',
|
||||
})
|
||||
# ---
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue