diff --git a/homeassistant/components/lcn/climate.py b/homeassistant/components/lcn/climate.py index 360b732c02e..1dff15c4f22 100644 --- a/homeassistant/components/lcn/climate.py +++ b/homeassistant/components/lcn/climate.py @@ -32,6 +32,7 @@ from .const import ( CONF_MAX_TEMP, CONF_MIN_TEMP, CONF_SETPOINT, + CONF_TARGET_VALUE_LOCKED, DOMAIN, ) from .entity import LcnEntity @@ -93,6 +94,9 @@ class LcnClimate(LcnEntity, ClimateEntity): self.regulator_id = pypck.lcn_defs.Var.to_set_point_id(self.setpoint) self.is_lockable = config[CONF_DOMAIN_DATA][CONF_LOCKABLE] + self.target_value_locked = config[CONF_DOMAIN_DATA].get( + CONF_TARGET_VALUE_LOCKED, -1 + ) self._max_temp = config[CONF_DOMAIN_DATA][CONF_MAX_TEMP] self._min_temp = config[CONF_DOMAIN_DATA][CONF_MIN_TEMP] @@ -171,7 +175,9 @@ class LcnClimate(LcnEntity, ClimateEntity): self._is_on = True self.async_write_ha_state() elif hvac_mode == HVACMode.OFF: - if not await self.device_connection.lock_regulator(self.regulator_id, True): + if not await self.device_connection.lock_regulator( + self.regulator_id, True, self.target_value_locked + ): return self._is_on = False self._target_temperature = None diff --git a/homeassistant/components/lcn/const.py b/homeassistant/components/lcn/const.py index cee9da9be43..b443e05def7 100644 --- a/homeassistant/components/lcn/const.py +++ b/homeassistant/components/lcn/const.py @@ -35,6 +35,7 @@ CONF_DIMMABLE = "dimmable" CONF_TRANSITION = "transition" CONF_MOTOR = "motor" CONF_LOCKABLE = "lockable" +CONF_TARGET_VALUE_LOCKED = "target_value_locked" CONF_VARIABLE = "variable" CONF_VALUE = "value" CONF_RELVARREF = "value_reference" diff --git a/homeassistant/components/lcn/manifest.json b/homeassistant/components/lcn/manifest.json index f5eb1654588..2ac183dcc97 100644 --- a/homeassistant/components/lcn/manifest.json +++ b/homeassistant/components/lcn/manifest.json @@ -8,5 +8,5 @@ "documentation": "https://www.home-assistant.io/integrations/lcn", "iot_class": "local_push", "loggers": ["pypck"], - "requirements": ["pypck==0.8.1", "lcn-frontend==0.2.2"] + "requirements": ["pypck==0.8.3", "lcn-frontend==0.2.3"] } diff --git a/homeassistant/components/lcn/schemas.py b/homeassistant/components/lcn/schemas.py index c9c91b9843d..809701c680a 100644 --- a/homeassistant/components/lcn/schemas.py +++ b/homeassistant/components/lcn/schemas.py @@ -24,6 +24,7 @@ from .const import ( CONF_REGISTER, CONF_REVERSE_TIME, CONF_SETPOINT, + CONF_TARGET_VALUE_LOCKED, CONF_TRANSITION, KEYS, LED_PORTS, @@ -58,6 +59,7 @@ DOMAIN_DATA_CLIMATE: VolDictType = { vol.Optional(CONF_MAX_TEMP, default=DEFAULT_MAX_TEMP): vol.Coerce(float), vol.Optional(CONF_MIN_TEMP, default=DEFAULT_MIN_TEMP): vol.Coerce(float), vol.Optional(CONF_LOCKABLE, default=False): vol.Coerce(bool), + vol.Optional(CONF_TARGET_VALUE_LOCKED, default=-1): vol.Coerce(float), vol.Optional(CONF_UNIT_OF_MEASUREMENT, default=UnitOfTemperature.CELSIUS): vol.In( UnitOfTemperature.CELSIUS, UnitOfTemperature.FAHRENHEIT ), diff --git a/requirements_all.txt b/requirements_all.txt index bc97607ef93..56d6c64ca53 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1287,7 +1287,7 @@ lakeside==0.13 laundrify-aio==1.2.2 # homeassistant.components.lcn -lcn-frontend==0.2.2 +lcn-frontend==0.2.3 # homeassistant.components.ld2410_ble ld2410-ble==0.1.1 @@ -2195,7 +2195,7 @@ pypalazzetti==0.1.19 pypca==0.0.7 # homeassistant.components.lcn -pypck==0.8.1 +pypck==0.8.3 # homeassistant.components.pjlink pypjlink2==1.2.1 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 215452c79a9..436238fa296 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1086,7 +1086,7 @@ lacrosse-view==1.0.3 laundrify-aio==1.2.2 # homeassistant.components.lcn -lcn-frontend==0.2.2 +lcn-frontend==0.2.3 # homeassistant.components.ld2410_ble ld2410-ble==0.1.1 @@ -1788,7 +1788,7 @@ pyownet==0.10.0.post1 pypalazzetti==0.1.19 # homeassistant.components.lcn -pypck==0.8.1 +pypck==0.8.3 # homeassistant.components.pjlink pypjlink2==1.2.1 diff --git a/tests/components/lcn/test_climate.py b/tests/components/lcn/test_climate.py index 7ba263bd597..7bac7cc9e81 100644 --- a/tests/components/lcn/test_climate.py +++ b/tests/components/lcn/test_climate.py @@ -107,7 +107,7 @@ async def test_set_hvac_mode_off(hass: HomeAssistant, entry: MockConfigEntry) -> blocking=True, ) - lock_regulator.assert_awaited_with(0, True) + lock_regulator.assert_awaited_with(0, True, -1) state = hass.states.get("climate.climate1") assert state is not None @@ -124,7 +124,7 @@ async def test_set_hvac_mode_off(hass: HomeAssistant, entry: MockConfigEntry) -> blocking=True, ) - lock_regulator.assert_awaited_with(0, True) + lock_regulator.assert_awaited_with(0, True, -1) state = hass.states.get("climate.climate1") assert state is not None