Esphome climate preset restore after manual change

Hi!
I have esphome climate working nice, but I would like to restore the default climate preset after 24 hours if any manual changes have been made, but do not know how to do it inside esp.
Example:
If someone changes preset to another preset than the new preset stays, but if someone changes temperature manually (for example from 22C to 15C), than after 24 hour the default preset (22 C) should be returned.
Any ideas?
Thank you!

Try this for climate thermostat component.

interval:
  - interval: 24h
    then:
      - climate.control:
          id: your_climate_id
          preset: your_preset_name

or just set target temperature, not using presets:

      - climate.control:
          id: your_climate_id
          target_temperature: your_target_temperature

Thank you for reply, but such uses preset every 24h, not since the last change and does not consider if the the temperature change was made manually or another preset was applied/

Easy :slight_smile:

climate:
...
    on_control:
      - lambda: |-
          if (x.get_target_temperature().has_value() 
           & (*x.get_target_temperature() != id(climate_pid).target_temperature)
          ) {
            id(climate_temperature_changed).execute();
          }

script:
  - id: climate_temperature_changed
    mode: restart
    then:
      - delay: 5s
      - climate.control:
          id: your_climate_id
          target_temperature: 21     

on_control fires on any change of mode or target temperature(s),

then if target temperature changed (x.get_target_temperature().has_value()) &
new temperature *x.get_target_temperature() not equal current id(your_climate_id).target_temperature - script gonna to be started.

mode: restart will ensure delay after last of change,
mode: single from first one.

Super cool!
works like a charm!
Thank you a lot!

Please check small change in code to prevent script starting on other actions like ON/OFF, but only target_temperature changes.

Did not get what should I check, could you post full script with changes?

This one edited to check only control event with new target temperature.

You are absolutely right! Now it works as it should, restores only when temperature is change. Script does not work when ON|OFF.
Thank you once again!

Just one more thing - at the end of script it is better to use custom_preset instead of target_temperature

It depends on Your need: change target temperature or activate preset, no problem. Or do whatever else.
Nice to help. See ya.

1 Like

As topic author - mark as solution, please.
It can help other to see is discussion is in progress or finished.

1 Like