Enhance smart heating configurations to include sleeping conditions and update fan mode handling in SmartHeatpump

This commit is contained in:
2026-05-31 21:50:06 +02:00
parent fc6673e98b
commit 89b08b1fc5
2 changed files with 46 additions and 9 deletions

View File

@@ -27,7 +27,7 @@ smart_heating_templates_library:
templates_library:
clim_conditions:
trigger_conditions:
- "not binary_sensor.heatpump_winter_mode and (ext_temperature >= room_temperature or ext_temperature >= target_temperature or cant_open_window) and room_temperature >= (quick_resume ? target_temperature : (target_temperature + 1))"
- "not binary_sensor.heatpump_winter_mode and (ext_temperature >= room_temperature or ext_temperature >= target_temperature or cant_open_window) and room_temperature >= ((quick_resume or sleeping_in_the_room)? target_temperature : (target_temperature + 1))"
- not binary_sensor.heatpump_winter_mode and self and (ext_temperature >= target_temperature or cant_open_window)
- binary_sensor.heatpump_winter_mode and room_temperature <= (target_temperature - 1) and ext_temperature <= 10
- binary_sensor.heatpump_winter_mode and self and room_temperature < target_temperature
@@ -50,8 +50,8 @@ desk_heatpump:
room_temperature: sensor.desk_temperature
room_occupancy: binary_sensor.desk_occupancy
target_temperature: sensor.target_temperature_heatpump
cant_open_window: false #binary_sensor.cant_open_window
sleeping_in_the_room: false #binary_sensor.is_bureau_sleeping
cant_open_window: binary_sensor.is_desk_sleeping
sleeping_in_the_room: binary_sensor.is_desk_sleeping
quick_resume: binary_sensor.desk_heatpump_quick_resume
stay_on_while_sleeping: false
@@ -90,10 +90,10 @@ bedroom_heatpump:
room_temperature: sensor.bedroom_temperature
room_occupancy: binary_sensor.bedroom_occupancy
target_temperature: sensor.target_temperature_heatpump
cant_open_window: false #binary_sensor.cant_open_window
cant_open_window: binary_sensor.is_bedroom_sleeping
sleeping_in_the_room: binary_sensor.is_bedroom_sleeping
quick_resume: binary_sensor.bedroom_heatpump_quick_resume
stay_on_while_sleeping: false
stay_on_while_sleeping: true
virtual_sensors:
sensors:
@@ -112,3 +112,36 @@ bedroom_heatpump:
quick_resume:
sensor: binary_sensor.bedroom_heatpump_quick_resume
reset_event: good_morning
living_room_heatpump:
module: smartheatpump
class: SmartHeatpump
entity: climate.living_room_heatpump
templates_library: smart_heating_templates_library
virtual_sensors:
sensors:
binary_sensor.living_room_any_window_open: binary_sensor.living_room_french_door or binary_sensor.living_room_window
constants:
window_open: binary_sensor.living_room_any_window_open
ext_temperature: sensor.ext_front_temperature
room_temperature: sensor.living_room_temperature
room_occupancy: binary_sensor.living_room_occupancy
target_temperature: sensor.target_temperature_heatpump
cant_open_window: binary_sensor.is_living_room_sleeping
sleeping_in_the_room: binary_sensor.is_living_room_sleeping
quick_resume: binary_sensor.living_room_heatpump_quick_resume
stay_on_while_sleeping: false
target_temperature: sensor.target_temperature_heatpump
hvac_mode: "binary_sensor.heatpump_winter_mode ? 'heat' : 'cool'"
smart_conditions:
callback_delay: 10 # on the morning it can happen that we ask to start and stop the heat pump immediately afterwards which in result in the heat pump ignoring the second command
template_conditions: <clim_conditions>
quick_resume:
sensor: binary_sensor.living_room_heatpump_quick_resume
reset_event: good_morning

View File

@@ -22,7 +22,10 @@ class SmartHeatpump(SmartObject):
else:
self.horizontal_vane = None
if 'fan_mode' in self.args:
self.fan_mode = SmartValue.Evaluator(self,self.args['fan_mode'], expression_name = 'fan_mode', on_change_cb = self.on_change_fan_mode, constants = self.constants)
else:
self.fan_mode = None
self.smart_conditions_evaluator = SmartCondition.Evaluator(self,self.args['smart_conditions'],condition_name = "smart_conditions",on_change_cb = self.on_smart_conditions_change,constants = self.constants, templates_library = self.templates_library)
if 'input_buttons' in self.args:
@@ -44,7 +47,7 @@ class SmartHeatpump(SmartObject):
self.set_state(self.args['quick_resume']['sensor'],state = 'on')
temperature = self.target_temperature.evaluate(False)
hvac_mode = self.hvac_mode.evaluate(False)
fan_mode = self.fan_mode.evaluate(False)
fan_mode = self.fan_mode.evaluate(False) if self.fan_mode else None
self.log_info(f"Starting Heatpump in {hvac_mode} mode, with target_temperature of {temperature}° and {fan_mode} fan speed")
#self.turn_on(self.entity_id)
@@ -53,6 +56,7 @@ class SmartHeatpump(SmartObject):
self.call_service("climate/set_hvac_mode", entity_id = self.entity_id,hvac_mode = hvac_mode)
time.sleep(1)
self.call_service("climate/set_temperature", entity_id = self.entity_id,temperature = temperature,hvac_mode = hvac_mode)
if self.fan_mode:
time.sleep(1)
self.call_service("climate/set_fan_mode", entity_id = self.entity_id,fan_mode = fan_mode)
if self.horizontal_vane: