Execute a Scheduler Action for the current timeslot

I have three large buttons controlling state helpers on my panel:

  • It’s cold outside (to enable the winter climate schedule)
  • It’s hot outside (to enable the summer climate schedule)
  • We’re on vacation (to set the climate controls to “away” mode)

My challenge is to set the climate setpoints to whatever they should be set at now whenever I enable the summer/winter schedules.

There is an action to run a Scheduler action for the timeslot at a specific time.

But is there a way to specify (via template?) to run the action that would have started whatever timeslot I happen to currently be in?

Hi @janick

I’m assuming that your setpoint values are stored as data within the time blocks within a schedule.

If this is the case then the current setpoint is available as an attribute of the schedule.

You could create a template that returns the current setpoint and use this to set the setpoint of your hvac.

Have a look at the attributes of your schedule in developer tools.

Let me know if you need more help.

Yes :slight_smile:
Some YAML template example would help.

Hi @janick

I created a button Helper called ‘My Test Button’ and a schedule Helper called ‘My Test Schedule’. I created a time period in the schedule and within this an attribute called ‘temperature’ and gave it the value of 21.

I then made the following automation:

alias: My Test Automation
description: ""
triggers:
  - trigger: state
    entity_id:
      - input_button.my_test_button
actions:
  - action: climate.set_temperature
    data_template:
      temperature: "{{ state_attr('schedule.my_test_schedule','temperature') }}"
      hvac_mode: heat
    target:
      entity_id: climate.thermostat
    enabled: true

Your HVAC control will be different.

I hope this helps. Let me know if you need more.

1 Like