mirror of
https://github.com/home-assistant/core.git
synced 2025-11-10 11:29:46 +00:00
Minor fixes to A. O. Smith integration (#107421)
This commit is contained in:
committed by
GitHub
parent
60fbb8b698
commit
a3352ce457
@@ -29,20 +29,10 @@ FIXTURE_USER_INPUT = {
|
||||
|
||||
|
||||
def build_device_fixture(
|
||||
mode_pending: bool, setpoint_pending: bool, has_vacation_mode: bool
|
||||
heat_pump: bool, mode_pending: bool, setpoint_pending: bool, has_vacation_mode: bool
|
||||
):
|
||||
"""Build a fixture for a device."""
|
||||
supported_modes: list[SupportedOperationModeInfo] = [
|
||||
SupportedOperationModeInfo(
|
||||
mode=OperationMode.HYBRID,
|
||||
original_name="HYBRID",
|
||||
has_day_selection=False,
|
||||
),
|
||||
SupportedOperationModeInfo(
|
||||
mode=OperationMode.HEAT_PUMP,
|
||||
original_name="HEAT_PUMP",
|
||||
has_day_selection=False,
|
||||
),
|
||||
SupportedOperationModeInfo(
|
||||
mode=OperationMode.ELECTRIC,
|
||||
original_name="ELECTRIC",
|
||||
@@ -50,6 +40,22 @@ def build_device_fixture(
|
||||
),
|
||||
]
|
||||
|
||||
if heat_pump:
|
||||
supported_modes.append(
|
||||
SupportedOperationModeInfo(
|
||||
mode=OperationMode.HYBRID,
|
||||
original_name="HYBRID",
|
||||
has_day_selection=False,
|
||||
)
|
||||
)
|
||||
supported_modes.append(
|
||||
SupportedOperationModeInfo(
|
||||
mode=OperationMode.HEAT_PUMP,
|
||||
original_name="HEAT_PUMP",
|
||||
has_day_selection=False,
|
||||
)
|
||||
)
|
||||
|
||||
if has_vacation_mode:
|
||||
supported_modes.append(
|
||||
SupportedOperationModeInfo(
|
||||
@@ -59,10 +65,18 @@ def build_device_fixture(
|
||||
)
|
||||
)
|
||||
|
||||
device_type = (
|
||||
DeviceType.NEXT_GEN_HEAT_PUMP if heat_pump else DeviceType.RE3_CONNECTED
|
||||
)
|
||||
|
||||
current_mode = OperationMode.HEAT_PUMP if heat_pump else OperationMode.ELECTRIC
|
||||
|
||||
model = "HPTS-50 200 202172000" if heat_pump else "EE12-50H55DVF 100,3806368"
|
||||
|
||||
return Device(
|
||||
brand="aosmith",
|
||||
model="HPTS-50 200 202172000",
|
||||
device_type=DeviceType.NEXT_GEN_HEAT_PUMP,
|
||||
model=model,
|
||||
device_type=device_type,
|
||||
dsn="dsn",
|
||||
junction_id="junctionId",
|
||||
name="My water heater",
|
||||
@@ -72,7 +86,7 @@ def build_device_fixture(
|
||||
status=DeviceStatus(
|
||||
firmware_version="2.14",
|
||||
is_online=True,
|
||||
current_mode=OperationMode.HEAT_PUMP,
|
||||
current_mode=current_mode,
|
||||
mode_change_pending=mode_pending,
|
||||
temperature_setpoint=130,
|
||||
temperature_setpoint_pending=setpoint_pending,
|
||||
@@ -121,6 +135,12 @@ def mock_setup_entry() -> Generator[AsyncMock, None, None]:
|
||||
yield mock_setup_entry
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def get_devices_fixture_heat_pump() -> bool:
|
||||
"""Return whether the device in the get_devices fixture should be a heat pump water heater."""
|
||||
return True
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def get_devices_fixture_mode_pending() -> bool:
|
||||
"""Return whether to set mode_pending in the get_devices fixture."""
|
||||
@@ -141,6 +161,7 @@ def get_devices_fixture_has_vacation_mode() -> bool:
|
||||
|
||||
@pytest.fixture
|
||||
async def mock_client(
|
||||
get_devices_fixture_heat_pump: bool,
|
||||
get_devices_fixture_mode_pending: bool,
|
||||
get_devices_fixture_setpoint_pending: bool,
|
||||
get_devices_fixture_has_vacation_mode: bool,
|
||||
@@ -148,9 +169,10 @@ async def mock_client(
|
||||
"""Return a mocked client."""
|
||||
get_devices_fixture = [
|
||||
build_device_fixture(
|
||||
get_devices_fixture_mode_pending,
|
||||
get_devices_fixture_setpoint_pending,
|
||||
get_devices_fixture_has_vacation_mode,
|
||||
heat_pump=get_devices_fixture_heat_pump,
|
||||
mode_pending=get_devices_fixture_mode_pending,
|
||||
setpoint_pending=get_devices_fixture_setpoint_pending,
|
||||
has_vacation_mode=get_devices_fixture_has_vacation_mode,
|
||||
)
|
||||
]
|
||||
get_all_device_info_fixture = load_json_object_fixture(
|
||||
|
||||
Reference in New Issue
Block a user