input_select: heat_pump_temperature_threshold: name: Master Bedroom Night Cycle Temperature Min options: - "18" - "19" - "20" - "21" - "22" - "23" initial: "20" icon: mdi:thermometer input_boolean: heat_pump_automation: name: Enable Heat Master Bedroom Night Cycling initial: off automation: - alias: "Master Bedroom Night Cycling" description: "Turns the climate.master_bedroom to 'cool' for 15 minutes every hour if temperature is below the selected threshold." trigger: - platform: time_pattern # Use time_pattern to run the automation on a recurring schedule. minutes: "/30" # The "0" means on the hour or "/15" means every 15 minutes. condition: # Ensure the automation is enabled - condition: state entity_id: input_boolean.heat_pump_automation state: "on" # Check that the current temperature is above the selected threshold - condition: template value_template: > {{ states('sensor.master_bedroom_environment_zth01_temperature_2') | float > states('input_select.heat_pump_temperature_threshold') | float }} # Actions: Define the steps of the automation. action: # Action 1: Turn on the heat pump by setting HVAC mode to "cool". - service: climate.set_hvac_mode target: entity_id: climate.master_bedroom data: hvac_mode: cool # Action 2: Keep the heat pump on for x minutes. - delay: "00:10:00" # Action 3: Turn off the heat pump. # Some integrations do not support hvac_mode: off via climate.set_hvac_mode, # so we use the dedicated climate.turn_off service. - service: climate.turn_off target: entity_id: climate.master_bedroom mode: single # Ensures only one instance of this automation runs at a time. # always switch off the automation at 5am - alias: "Disable Heat Pump Automation at 5AM" description: "Automatically turns off the heat pump automation (input_boolean.heat_pump_automation) at 5 AM." trigger: - platform: time at: "04:59:00" action: - service: input_boolean.turn_off target: entity_id: input_boolean.heat_pump_automation mode: single # ensure the heat pump is off at 5am if not already - alias: "Ensure Heat Pump Off at 5 AM" trigger: - platform: time at: "05:00:00" action: - service: climate.turn_off target: entity_id: climate.master_bedroom mode: single