Disable/enable a schedule through an automation

I have an automation that sets my theromostat target temperature according to a schedule, as per below (I have not used
the schedule helper, but written the schedule in schedule.yaml)

thermostat_schedule_livingroom:
  name: "Thermostat schedule livingroom"
  monday:
    - from: "08:00:00"
      to: "21:00:00"
  tuesday:
    - from: "08:00:00"
      to: "21:00:00"
  wednesday:
    - from: "08:00:00"
      to: "21:00:00"
  thursday:
    - from: "08:00:00"
      to: "21:00:00"
  friday:
    - from: "08:00:00"
      to: "21:00:00"
  saturday:
    - from: "08:00:00"
      to: "21:00:00"
  sunday:
    - from: "08:00:00"
      to: "21:00:00"

I would like to add a “boost” automation that increases the target temperature for a user-specified time regardless of the schedule, and then returns the temperature to what it should be, given the time of day (7 when the schedule is off and states('input_number.schedule_target_temp_livingroom') when the schedule is on).

alias: boost_livingroom
description: Boost living room heat for specified time
trigger:
  - platform: state
    entity_id:
      - input_button.boost_livingroom
condition: []
action:
  - service: climate.set_temperature
    target:
      entity_id: climate.lumi_lumi_airrtc_agl001_thermostat_2
    data:
      temperature: 24
      hvac_mode: heat
    enabled: true
  - delay: "{{(states('input_number.boost_time_livingroom')|int) * 3600}}"
  - if:
      - condition: state
        entity_id: schedule.thermostat_schedule_livingroom
        state: "on"
    then:
      - service: climate.set_temperature
        target:
          entity_id: climate.lumi_lumi_airrtc_agl001_thermostat_2
        data:
          temperature: "{{states('input_number.schedule_target_temp_livingroom')}}"
          hvac_mode: heat
    else:
      - service: climate.set_temperature
        target:
          entity_id: climate.lumi_lumi_airrtc_agl001_thermostat_2
        data:
          temperature: 7
          hvac_mode: heat
 mode: single

This works fine, as long as the schedule doesn’t switch state during the delay period. If it does, the thermostat changes to the schedule-controlled defaults instead of completing the boost-delay period.

I thought that the simplest approach would be to disable the schedule while the boost automation is activated. Is there a way to disable/enable the schedule within the boost automation actions?

I have seen this post about schedule helper Ability to override Schedule Helpers, but it does not seem to have had responses.
Also Universal Override Timer - #8 by 123

This should be as simple as adding an extra condition - boost is not active - in the automation that executes the schedule?

1 Like