mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 07:07:28 +00:00
Return expected state in SmartThings water heater (#146449)
This commit is contained in:
parent
b77ef7304a
commit
110627e16e
@ -619,15 +619,6 @@
|
|||||||
"keep_fresh_mode": {
|
"keep_fresh_mode": {
|
||||||
"name": "Keep fresh mode"
|
"name": "Keep fresh mode"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"water_heater": {
|
|
||||||
"water_heater": {
|
|
||||||
"state": {
|
|
||||||
"standard": "Standard",
|
|
||||||
"force": "Forced",
|
|
||||||
"power": "Power"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"issues": {
|
"issues": {
|
||||||
|
@ -10,6 +10,9 @@ from homeassistant.components.water_heater import (
|
|||||||
DEFAULT_MAX_TEMP,
|
DEFAULT_MAX_TEMP,
|
||||||
DEFAULT_MIN_TEMP,
|
DEFAULT_MIN_TEMP,
|
||||||
STATE_ECO,
|
STATE_ECO,
|
||||||
|
STATE_HEAT_PUMP,
|
||||||
|
STATE_HIGH_DEMAND,
|
||||||
|
STATE_PERFORMANCE,
|
||||||
WaterHeaterEntity,
|
WaterHeaterEntity,
|
||||||
WaterHeaterEntityFeature,
|
WaterHeaterEntityFeature,
|
||||||
)
|
)
|
||||||
@ -24,9 +27,9 @@ from .entity import SmartThingsEntity
|
|||||||
|
|
||||||
OPERATION_MAP_TO_HA: dict[str, str] = {
|
OPERATION_MAP_TO_HA: dict[str, str] = {
|
||||||
"eco": STATE_ECO,
|
"eco": STATE_ECO,
|
||||||
"std": "standard",
|
"std": STATE_HEAT_PUMP,
|
||||||
"force": "force",
|
"force": STATE_HIGH_DEMAND,
|
||||||
"power": "power",
|
"power": STATE_PERFORMANCE,
|
||||||
}
|
}
|
||||||
|
|
||||||
HA_TO_OPERATION_MAP = {v: k for k, v in OPERATION_MAP_TO_HA.items()}
|
HA_TO_OPERATION_MAP = {v: k for k, v in OPERATION_MAP_TO_HA.items()}
|
||||||
|
@ -10,9 +10,9 @@
|
|||||||
'operation_list': list([
|
'operation_list': list([
|
||||||
'off',
|
'off',
|
||||||
'eco',
|
'eco',
|
||||||
'standard',
|
'heat_pump',
|
||||||
'power',
|
'performance',
|
||||||
'force',
|
'high_demand',
|
||||||
]),
|
]),
|
||||||
}),
|
}),
|
||||||
'config_entry_id': <ANY>,
|
'config_entry_id': <ANY>,
|
||||||
@ -55,9 +55,9 @@
|
|||||||
'operation_list': list([
|
'operation_list': list([
|
||||||
'off',
|
'off',
|
||||||
'eco',
|
'eco',
|
||||||
'standard',
|
'heat_pump',
|
||||||
'power',
|
'performance',
|
||||||
'force',
|
'high_demand',
|
||||||
]),
|
]),
|
||||||
'operation_mode': 'off',
|
'operation_mode': 'off',
|
||||||
'supported_features': <WaterHeaterEntityFeature: 14>,
|
'supported_features': <WaterHeaterEntityFeature: 14>,
|
||||||
@ -84,8 +84,8 @@
|
|||||||
'operation_list': list([
|
'operation_list': list([
|
||||||
'off',
|
'off',
|
||||||
'eco',
|
'eco',
|
||||||
'standard',
|
'heat_pump',
|
||||||
'force',
|
'high_demand',
|
||||||
]),
|
]),
|
||||||
}),
|
}),
|
||||||
'config_entry_id': <ANY>,
|
'config_entry_id': <ANY>,
|
||||||
@ -128,8 +128,8 @@
|
|||||||
'operation_list': list([
|
'operation_list': list([
|
||||||
'off',
|
'off',
|
||||||
'eco',
|
'eco',
|
||||||
'standard',
|
'heat_pump',
|
||||||
'force',
|
'high_demand',
|
||||||
]),
|
]),
|
||||||
'operation_mode': 'off',
|
'operation_mode': 'off',
|
||||||
'supported_features': <WaterHeaterEntityFeature: 14>,
|
'supported_features': <WaterHeaterEntityFeature: 14>,
|
||||||
@ -156,9 +156,9 @@
|
|||||||
'operation_list': list([
|
'operation_list': list([
|
||||||
'off',
|
'off',
|
||||||
'eco',
|
'eco',
|
||||||
'standard',
|
'heat_pump',
|
||||||
'power',
|
'performance',
|
||||||
'force',
|
'high_demand',
|
||||||
]),
|
]),
|
||||||
}),
|
}),
|
||||||
'config_entry_id': <ANY>,
|
'config_entry_id': <ANY>,
|
||||||
@ -201,11 +201,11 @@
|
|||||||
'operation_list': list([
|
'operation_list': list([
|
||||||
'off',
|
'off',
|
||||||
'eco',
|
'eco',
|
||||||
'standard',
|
'heat_pump',
|
||||||
'power',
|
'performance',
|
||||||
'force',
|
'high_demand',
|
||||||
]),
|
]),
|
||||||
'operation_mode': 'standard',
|
'operation_mode': 'heat_pump',
|
||||||
'supported_features': <WaterHeaterEntityFeature: 15>,
|
'supported_features': <WaterHeaterEntityFeature: 15>,
|
||||||
'target_temp_high': 57,
|
'target_temp_high': 57,
|
||||||
'target_temp_low': 40,
|
'target_temp_low': 40,
|
||||||
@ -216,6 +216,6 @@
|
|||||||
'last_changed': <ANY>,
|
'last_changed': <ANY>,
|
||||||
'last_reported': <ANY>,
|
'last_reported': <ANY>,
|
||||||
'last_updated': <ANY>,
|
'last_updated': <ANY>,
|
||||||
'state': 'standard',
|
'state': 'heat_pump',
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
|
@ -20,6 +20,9 @@ from homeassistant.components.water_heater import (
|
|||||||
SERVICE_SET_OPERATION_MODE,
|
SERVICE_SET_OPERATION_MODE,
|
||||||
SERVICE_SET_TEMPERATURE,
|
SERVICE_SET_TEMPERATURE,
|
||||||
STATE_ECO,
|
STATE_ECO,
|
||||||
|
STATE_HEAT_PUMP,
|
||||||
|
STATE_HIGH_DEMAND,
|
||||||
|
STATE_PERFORMANCE,
|
||||||
WaterHeaterEntityFeature,
|
WaterHeaterEntityFeature,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
@ -66,9 +69,9 @@ async def test_all_entities(
|
|||||||
("operation_mode", "argument"),
|
("operation_mode", "argument"),
|
||||||
[
|
[
|
||||||
(STATE_ECO, "eco"),
|
(STATE_ECO, "eco"),
|
||||||
("standard", "std"),
|
(STATE_HEAT_PUMP, "std"),
|
||||||
("force", "force"),
|
(STATE_HIGH_DEMAND, "force"),
|
||||||
("power", "power"),
|
(STATE_PERFORMANCE, "power"),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_set_operation_mode(
|
async def test_set_operation_mode(
|
||||||
@ -299,9 +302,9 @@ async def test_operation_list_update(
|
|||||||
] == [
|
] == [
|
||||||
STATE_OFF,
|
STATE_OFF,
|
||||||
STATE_ECO,
|
STATE_ECO,
|
||||||
"standard",
|
STATE_HEAT_PUMP,
|
||||||
"power",
|
STATE_PERFORMANCE,
|
||||||
"force",
|
STATE_HIGH_DEMAND,
|
||||||
]
|
]
|
||||||
|
|
||||||
await trigger_update(
|
await trigger_update(
|
||||||
@ -318,8 +321,8 @@ async def test_operation_list_update(
|
|||||||
] == [
|
] == [
|
||||||
STATE_OFF,
|
STATE_OFF,
|
||||||
STATE_ECO,
|
STATE_ECO,
|
||||||
"force",
|
STATE_HIGH_DEMAND,
|
||||||
"power",
|
STATE_PERFORMANCE,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@ -332,7 +335,7 @@ async def test_current_operation_update(
|
|||||||
"""Test state update."""
|
"""Test state update."""
|
||||||
await setup_integration(hass, mock_config_entry)
|
await setup_integration(hass, mock_config_entry)
|
||||||
|
|
||||||
assert hass.states.get("water_heater.warmepumpe").state == "standard"
|
assert hass.states.get("water_heater.warmepumpe").state == STATE_HEAT_PUMP
|
||||||
|
|
||||||
await trigger_update(
|
await trigger_update(
|
||||||
hass,
|
hass,
|
||||||
@ -356,7 +359,7 @@ async def test_switch_update(
|
|||||||
await setup_integration(hass, mock_config_entry)
|
await setup_integration(hass, mock_config_entry)
|
||||||
|
|
||||||
state = hass.states.get("water_heater.warmepumpe")
|
state = hass.states.get("water_heater.warmepumpe")
|
||||||
assert state.state == "standard"
|
assert state.state == STATE_HEAT_PUMP
|
||||||
assert (
|
assert (
|
||||||
state.attributes[ATTR_SUPPORTED_FEATURES]
|
state.attributes[ATTR_SUPPORTED_FEATURES]
|
||||||
== WaterHeaterEntityFeature.ON_OFF
|
== WaterHeaterEntityFeature.ON_OFF
|
||||||
@ -516,7 +519,7 @@ async def test_availability(
|
|||||||
"""Test availability."""
|
"""Test availability."""
|
||||||
await setup_integration(hass, mock_config_entry)
|
await setup_integration(hass, mock_config_entry)
|
||||||
|
|
||||||
assert hass.states.get("water_heater.warmepumpe").state == "standard"
|
assert hass.states.get("water_heater.warmepumpe").state == STATE_HEAT_PUMP
|
||||||
|
|
||||||
await trigger_health_update(
|
await trigger_health_update(
|
||||||
hass, devices, "3810e5ad-5351-d9f9-12ff-000001200000", HealthStatus.OFFLINE
|
hass, devices, "3810e5ad-5351-d9f9-12ff-000001200000", HealthStatus.OFFLINE
|
||||||
@ -528,7 +531,7 @@ async def test_availability(
|
|||||||
hass, devices, "3810e5ad-5351-d9f9-12ff-000001200000", HealthStatus.ONLINE
|
hass, devices, "3810e5ad-5351-d9f9-12ff-000001200000", HealthStatus.ONLINE
|
||||||
)
|
)
|
||||||
|
|
||||||
assert hass.states.get("water_heater.warmepumpe").state == "standard"
|
assert hass.states.get("water_heater.warmepumpe").state == STATE_HEAT_PUMP
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("device_fixture", ["da_sac_ehs_000002_sub"])
|
@pytest.mark.parametrize("device_fixture", ["da_sac_ehs_000002_sub"])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user