From c08afca9124cf608452a5728cc6cbf94ed25679d Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 19 Apr 2022 09:46:42 -1000 Subject: [PATCH] Revert "Add target_temp_step to generic_thermostat (#58691)" (#70299) This reverts commit ba4ca3e38e87fe40d673328993358ad6a519c3c6. --- .../components/generic_thermostat/climate.py | 13 ++----------- tests/components/generic_thermostat/test_climate.py | 8 +------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/homeassistant/components/generic_thermostat/climate.py b/homeassistant/components/generic_thermostat/climate.py index 081bf1900d6..56b0dad3416 100644 --- a/homeassistant/components/generic_thermostat/climate.py +++ b/homeassistant/components/generic_thermostat/climate.py @@ -75,7 +75,6 @@ CONF_HOT_TOLERANCE = "hot_tolerance" CONF_KEEP_ALIVE = "keep_alive" CONF_INITIAL_HVAC_MODE = "initial_hvac_mode" CONF_PRECISION = "precision" -CONF_TEMP_STEP = "target_temp_step" CONF_PRESETS = { p: f"{p}_temp" @@ -107,9 +106,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( vol.Optional(CONF_PRECISION): vol.In( [PRECISION_TENTHS, PRECISION_HALVES, PRECISION_WHOLE] ), - vol.Optional(CONF_TEMP_STEP): vol.In( - [PRECISION_TENTHS, PRECISION_HALVES, PRECISION_WHOLE] - ), vol.Optional(CONF_UNIQUE_ID): cv.string, } ).extend({vol.Optional(v): vol.Coerce(float) for (k, v) in CONF_PRESETS.items()}) @@ -141,7 +137,6 @@ async def async_setup_platform( key: config[value] for key, value in CONF_PRESETS.items() if value in config } precision = config.get(CONF_PRECISION) - target_temperature_step = config.get(CONF_TEMP_STEP) unit = hass.config.units.temperature_unit unique_id = config.get(CONF_UNIQUE_ID) @@ -162,7 +157,6 @@ async def async_setup_platform( initial_hvac_mode, presets, precision, - target_temperature_step, unit, unique_id, ) @@ -189,7 +183,6 @@ class GenericThermostat(ClimateEntity, RestoreEntity): initial_hvac_mode, presets, precision, - target_temperature_step, unit, unique_id, ): @@ -205,7 +198,6 @@ class GenericThermostat(ClimateEntity, RestoreEntity): self._hvac_mode = initial_hvac_mode self._saved_target_temp = target_temp or next(iter(presets.values()), None) self._temp_precision = precision - self._temp_target_temperature_step = target_temperature_step if self.ac_mode: self._hvac_list = [HVAC_MODE_COOL, HVAC_MODE_OFF] else: @@ -333,9 +325,8 @@ class GenericThermostat(ClimateEntity, RestoreEntity): @property def target_temperature_step(self): """Return the supported step of target temperature.""" - if self._temp_target_temperature_step is not None: - return self._temp_target_temperature_step - # if a target_temperature_step is not defined, fallback to equal the precision + # Since this integration does not yet have a step size parameter + # we have to re-use the precision as the step size for now. return self.precision @property diff --git a/tests/components/generic_thermostat/test_climate.py b/tests/components/generic_thermostat/test_climate.py index 43eb8b68d31..1720a54d973 100644 --- a/tests/components/generic_thermostat/test_climate.py +++ b/tests/components/generic_thermostat/test_climate.py @@ -62,7 +62,6 @@ MAX_TEMP = 65.0 TARGET_TEMP = 42.0 COLD_TOLERANCE = 0.5 HOT_TOLERANCE = 0.5 -TARGET_TEMP_STEP = 0.5 async def test_setup_missing_conf(hass): @@ -277,7 +276,6 @@ async def test_default_setup_params(hass, setup_comp_2): assert state.attributes.get("min_temp") == 7 assert state.attributes.get("max_temp") == 35 assert state.attributes.get("temperature") == 7 - assert state.attributes.get("target_temp_step") == 0.1 async def test_get_hvac_modes(hass, setup_comp_2): @@ -1181,7 +1179,7 @@ async def test_temp_change_heater_trigger_off_long_enough_2(hass, setup_comp_8): @pytest.fixture async def setup_comp_9(hass): """Initialize components.""" - hass.config.units.temperature_unit = TEMP_FAHRENHEIT + hass.config.temperature_unit = TEMP_FAHRENHEIT assert await async_setup_component( hass, DOMAIN, @@ -1208,8 +1206,6 @@ async def test_precision(hass, setup_comp_9): await common.async_set_temperature(hass, 23.27) state = hass.states.get(ENTITY) assert state.attributes.get("temperature") == 23.3 - # check that target_temp_step defaults to precision - assert state.attributes.get("target_temp_step") == 0.1 async def test_custom_setup_params(hass): @@ -1226,7 +1222,6 @@ async def test_custom_setup_params(hass): "min_temp": MIN_TEMP, "max_temp": MAX_TEMP, "target_temp": TARGET_TEMP, - "target_temp_step": 0.5, } }, ) @@ -1236,7 +1231,6 @@ async def test_custom_setup_params(hass): assert state.attributes.get("min_temp") == MIN_TEMP assert state.attributes.get("max_temp") == MAX_TEMP assert state.attributes.get("temperature") == TARGET_TEMP - assert state.attributes.get("target_temp_step") == TARGET_TEMP_STEP @pytest.mark.parametrize("hvac_mode", [HVAC_MODE_OFF, HVAC_MODE_HEAT, HVAC_MODE_COOL])