9898}
9999
100100THERMOSTATS : list [LuxtronikClimateDescription ] = [
101+ LuxtronikClimateDescription (
102+ key = SensorKey .HEATING ,
103+ hvac_modes = [HVACMode .HEAT , HVACMode .OFF ],
104+ hvac_mode_mapping = HVAC_MODE_MAPPING_HEAT ,
105+ hvac_action_mapping = HVAC_ACTION_MAPPING_HEAT ,
106+ preset_modes = [PRESET_NONE , PRESET_AWAY , PRESET_BOOST ],
107+ supported_features = ClimateEntityFeature .PRESET_MODE
108+ | ClimateEntityFeature .TURN_OFF # noqa: W503
109+ | ClimateEntityFeature .TURN_ON # noqa: W503
110+ | ClimateEntityFeature .TARGET_TEMPERATURE , # noqa: W503
111+ luxtronik_key = LuxParameter .P0003_MODE_HEATING ,
112+ luxtronik_key_current_temperature = LuxCalculation .C0227_ROOM_THERMOSTAT_TEMPERATURE ,
113+ luxtronik_key_target_temperature = LuxParameter .P1148_HEATING_TARGET_TEMP_RBE ,
114+ # luxtronik_key_has_target_temperature=LuxParameter
115+ luxtronik_key_current_action = LuxCalculation .C0080_STATUS ,
116+ luxtronik_action_active = LuxOperationMode .heating .value ,
117+ # luxtronik_key_target_temperature_high=LuxParameter,
118+ # luxtronik_key_target_temperature_low=LuxParameter,
119+ icon_by_state = LUX_STATE_ICON_MAP ,
120+ temperature_unit = UnitOfTemperature .CELSIUS ,
121+ visibility = LuxVisibility .V0023_FLOW_IN_TEMPERATURE ,
122+ device_key = DeviceKey .heating ,
123+ min_firmware_version = Version ("3.90.1" ),
124+ ),
101125 LuxtronikClimateDescription (
102126 key = SensorKey .HEATING ,
103127 hvac_modes = [HVACMode .HEAT , HVACMode .OFF ],
122146 temperature_unit = UnitOfTemperature .CELSIUS ,
123147 visibility = LuxVisibility .V0023_FLOW_IN_TEMPERATURE ,
124148 device_key = DeviceKey .heating ,
125- ),
149+ max_firmware_version = Version ("3.90.0" ),
150+ ),
126151 LuxtronikClimateDescription (
127152 key = SensorKey .COOLING ,
128153 hvac_modes = [HVACMode .COOL , HVACMode .OFF ],
@@ -270,38 +295,43 @@ def _handle_coordinator_update(
270295 self ._attr_current_temperature = state_as_number_or_none (temp , 0.0 )
271296 elif key != LuxCalculation .UNSET :
272297 self ._attr_current_temperature = get_sensor_data (data , key )
298+
273299 key_tar = self .entity_description .luxtronik_key_target_temperature
274- if key_tar != LuxParameter .UNSET :
300+ if key_tar == LuxParameter .P1148_HEATING_TARGET_TEMP_RBE :
301+ self ._attr_target_temperature = get_sensor_data (data , key_tar ) / 10
302+ elif key_tar != LuxParameter .UNSET :
275303 self ._attr_target_temperature = get_sensor_data (data , key_tar )
276- correction_factor = get_sensor_data (
277- data , self .entity_description .luxtronik_key_correction_factor .value , False
278- )
279- # LOGGER.info(f"self._attr_target_temperature={self._attr_target_temperature}")
280- # LOGGER.info(f"self._attr_current_temperature={self._attr_current_temperature}")
281- # LOGGER.info(f"correction_factor={correction_factor}")
282- # LOGGER.info(f"lux_action={lux_action}")
283- # LOGGER.info(f"_attr_hvac_action={self._attr_hvac_action}")
284- if (
285- self ._attr_target_temperature is not None
286- and self ._attr_current_temperature is not None # noqa: W503
287- and self ._attr_current_temperature > 0.0
288- and correction_factor is not None # noqa: W503
289- ):
290- delta_temp = self ._attr_target_temperature - self ._attr_current_temperature
291- correction = round (
292- delta_temp * (correction_factor / 100.0 ), 1
293- ) # correction_factor is in %, so need to divide by 100
294- key_correction_target = (
295- self .entity_description .luxtronik_key_correction_target .value
304+
305+ if key_tar == LuxCalculation .C0228_ROOM_THERMOSTAT_TEMPERATURE_TARGET :
306+ correction_factor = get_sensor_data (
307+ data , self .entity_description .luxtronik_key_correction_factor .value , False
296308 )
297- correction_current = get_sensor_data (data , key_correction_target )
298- # LOGGER.info(f"correction_current={correction_current}")
299- # LOGGER.info(f"correction={correction}")
300- if correction_current is None or correction_current != correction :
301- # LOGGER.info(f'key_correction_target={key_correction_target.split(".")[1]}')
302- _ = self .coordinator .write (
303- key_correction_target .split ("." )[1 ], correction
304- ) # mypy: allow-unused-coroutine
309+ # LOGGER.info(f"self._attr_target_temperature={self._attr_target_temperature}")
310+ # LOGGER.info(f"self._attr_current_temperature={self._attr_current_temperature}")
311+ # LOGGER.info(f"correction_factor={correction_factor}")
312+ # LOGGER.info(f"lux_action={lux_action}")
313+ # LOGGER.info(f"_attr_hvac_action={self._attr_hvac_action}")
314+ if (
315+ self ._attr_target_temperature is not None
316+ and self ._attr_current_temperature is not None # noqa: W503
317+ and self ._attr_current_temperature > 0.0
318+ and correction_factor is not None # noqa: W503
319+ ):
320+ delta_temp = self ._attr_target_temperature - self ._attr_current_temperature
321+ correction = round (
322+ delta_temp * (correction_factor / 100.0 ), 1
323+ ) # correction_factor is in %, so need to divide by 100
324+ key_correction_target = (
325+ self .entity_description .luxtronik_key_correction_target .value
326+ )
327+ correction_current = get_sensor_data (data , key_correction_target )
328+ # LOGGER.info(f"correction_current={correction_current}")
329+ # LOGGER.info(f"correction={correction}")
330+ if correction_current is None or correction_current != correction :
331+ # LOGGER.info(f'key_correction_target={key_correction_target.split(".")[1]}')
332+ _ = self .coordinator .write (
333+ key_correction_target .split ("." )[1 ], correction
334+ ) # mypy: allow-unused-coroutine
305335
306336 super ()._handle_coordinator_update ()
307337
@@ -312,12 +342,15 @@ async def _async_set_lux_mode(self, lux_mode: str) -> None:
312342
313343 async def async_set_temperature (self , ** kwargs : Any ) -> None :
314344 """Set new target temperature."""
315- value = kwargs .get (ATTR_TEMPERATURE )
316- lux_key = LuxParameter .P1148_HEATING_TARGET_TEMP_ROOM_THERMOSTAT
317- data : LuxtronikCoordinatorData | None = await self .coordinator .async_write (
318- lux_key .split ("." )[1 ], int (value * 10 )
319- )
320- self ._handle_coordinator_update (data )
345+ self ._attr_target_temperature = kwargs [ATTR_TEMPERATURE ]
346+ key_tar = self .entity_description .luxtronik_key_target_temperature
347+ if key_tar == LuxParameter .P1148_HEATING_TARGET_TEMP_RBE :
348+ data : LuxtronikCoordinatorData | None = await self .coordinator .async_write (
349+ key_tar .split ("." )[1 ], int (self ._attr_target_temperature * 10 )
350+ )
351+ self ._handle_coordinator_update (data )
352+ elif key_tar != LuxCalculation .C0228_ROOM_THERMOSTAT_TEMPERATURE_TARGET
353+ super ()._handle_coordinator_update ()
321354
322355 async def async_turn_off (self ) -> None :
323356 await self .async_set_hvac_mode (HVACMode .OFF )
0 commit comments