From 708124b8310478807f2c377e3102cca75c16d49d Mon Sep 17 00:00:00 2001 From: zerzhang <916250497@qq.com> Date: Mon, 27 Oct 2025 14:21:35 +0800 Subject: [PATCH 1/2] fix --- switchbot/const/climate.py | 4 ++-- switchbot/devices/smart_thermostat_radiator.py | 8 ++++---- tests/test_smart_thermostat_radiator.py | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/switchbot/const/climate.py b/switchbot/const/climate.py index a3f4d38b..0aa4e69d 100644 --- a/switchbot/const/climate.py +++ b/switchbot/const/climate.py @@ -29,9 +29,9 @@ class SmartThermostatRadiatorMode(Enum): SCHEDULE = 0 MANUAL = 1 OFF = 2 - ECONOMIC = 3 + ECO = 3 COMFORT = 4 - FAST_HEATING = 5 + BOOST = 5 @property def lname(self) -> str: diff --git a/switchbot/devices/smart_thermostat_radiator.py b/switchbot/devices/smart_thermostat_radiator.py index e0a9798f..ca6da7ed 100644 --- a/switchbot/devices/smart_thermostat_radiator.py +++ b/switchbot/devices/smart_thermostat_radiator.py @@ -32,13 +32,13 @@ # fast heating default use max temperature COMMAND_SET_TEMP = { STRMode.MANUAL.lname: "570F7801{temp:04X}", - STRMode.ECONOMIC.lname: "570F7802{temp:02X}", + STRMode.ECO.lname: "570F7802{temp:02X}", STRMode.COMFORT.lname: "570F7803{temp:02X}", STRMode.SCHEDULE.lname: "570F7806{temp:04X}", } MODE_TEMP_RANGE = { - STRMode.ECONOMIC.lname: (10.0, 20.0), + STRMode.ECO.lname: (10.0, 20.0), STRMode.COMFORT.lname: (10.0, 25.0), } @@ -139,9 +139,9 @@ async def set_target_temperature(self, temperature: float) -> bool: """Send command to set target temperature.""" if self.preset_mode == STRMode.OFF.lname: raise SwitchbotOperationError("Cannot set temperature when mode is OFF.") - if self.preset_mode == STRMode.FAST_HEATING.lname: + if self.preset_mode == STRMode.BOOST.lname: raise SwitchbotOperationError( - "Fast Heating mode defaults to max temperature." + "Boost mode defaults to max temperature." ) temp_value = int(temperature * 10) diff --git a/tests/test_smart_thermostat_radiator.py b/tests/test_smart_thermostat_radiator.py index 069cb8e1..3ad3035d 100644 --- a/tests/test_smart_thermostat_radiator.py +++ b/tests/test_smart_thermostat_radiator.py @@ -103,9 +103,9 @@ async def test_set_hvac_mode_commands(mode, expected_command) -> None: (STRMode.SCHEDULE.lname, COMMAND_SET_MODE[STRMode.SCHEDULE.lname]), (STRMode.MANUAL.lname, COMMAND_SET_MODE[STRMode.MANUAL.lname]), (STRMode.OFF.lname, COMMAND_SET_MODE[STRMode.OFF.lname]), - (STRMode.ECONOMIC.lname, COMMAND_SET_MODE[STRMode.ECONOMIC.lname]), + (STRMode.ECO.lname, COMMAND_SET_MODE[STRMode.ECO.lname]), (STRMode.COMFORT.lname, COMMAND_SET_MODE[STRMode.COMFORT.lname]), - (STRMode.FAST_HEATING.lname, COMMAND_SET_MODE[STRMode.FAST_HEATING.lname]), + (STRMode.BOOST.lname, COMMAND_SET_MODE[STRMode.BOOST.lname]), ], ) @pytest.mark.asyncio @@ -131,7 +131,7 @@ async def test_set_target_temperature_command() -> None: ("mode", "match"), [ (STRMode.OFF.lname, "Cannot set temperature when mode is OFF."), - (STRMode.FAST_HEATING.lname, "Fast Heating mode defaults to max temperature."), + (STRMode.BOOST.lname, "Boost mode defaults to max temperature."), ], ) async def test_set_target_temperature_with_invalid_mode(mode, match) -> None: @@ -180,7 +180,7 @@ async def test_get_basic_info_none() -> None: 0.8, 62, "comfort", - "economic", + "eco", 24.0, 4.0, 13.0, From 774951728feccd67cc5c163124042b63f5d6abf4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 27 Oct 2025 06:24:47 +0000 Subject: [PATCH 2/2] chore(pre-commit.ci): auto fixes --- switchbot/devices/smart_thermostat_radiator.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/switchbot/devices/smart_thermostat_radiator.py b/switchbot/devices/smart_thermostat_radiator.py index ca6da7ed..729a1c0a 100644 --- a/switchbot/devices/smart_thermostat_radiator.py +++ b/switchbot/devices/smart_thermostat_radiator.py @@ -140,9 +140,7 @@ async def set_target_temperature(self, temperature: float) -> bool: if self.preset_mode == STRMode.OFF.lname: raise SwitchbotOperationError("Cannot set temperature when mode is OFF.") if self.preset_mode == STRMode.BOOST.lname: - raise SwitchbotOperationError( - "Boost mode defaults to max temperature." - ) + raise SwitchbotOperationError("Boost mode defaults to max temperature.") temp_value = int(temperature * 10) cmd = COMMAND_SET_TEMP[self.preset_mode].format(temp=temp_value)