Set target temperature in my home if someone changes the target temperature

So up until 2 weeks ago I never even heard of Home Assistant much less Hass.io. I’ve been using Homebridge to get a few devices Homekit and life has been good for about the last 12 months or so. A couple of weeks back I added a second door sensor to my MyQ garage door hub and it stopped working correctly. As I was researching a fix I came across a video on Hass.io. I did some independent research and now I’m freaking hooked. This software is so damn cool and the possibilities seem endless. Long story short I was able to solve a nagging issue where an overextend house guest likes to turn our AC unit down way below I want it to be. I’ve asked a million times but this house guest still does it. I created the automation below to reset the target temperature in the house to 77 degrees every 10 mins. This works well, it does what I need but in the back of my head I don’t like this solution the way it is because it will blindly set the target temperature regardless if it is already set to 77. I would like to add a condition that will check to see if the temperature is set to a value lower then 77 and then fire the action. If the target temperature is 78 or higher then the automation will not fire.

Any ideas on how to achieve this?

Here is my current automation

- id: 'CORTEMP-01'
  alias: 'Set COR Temp - 10 Mins'
  trigger:  
    platform: time_pattern
    minutes: '/10'
    seconds: 0
  condition: []
  action:
  - data:
      entity_id: climate.my_home
      operation_mode: Cool
      temperature: 78
    service: climate.set_temperature

The strategy you’ve chosen is to set the temperature to 77 every 10 minutes. I suggest you consider another strategy: set it to 77 only if the temperature is set to lower than 77. In other words, there’s no need to periodically check the temperature every 10 minutes. Make the automation’s trigger be the thermostat’s target temperature. If someone changes it to less than 77, the automation is triggered and sets it back to 77.

Numeric State Trigger

@123 Thanks for the input. I like your suggestion, ultimately that’s the path I would prefer but didn’t quite know how to get there from here. I’ll check out the Numeric State Trigger. Thanks again.

@123 you’re awesome, I really appreciate the guidance. Using your suggestion I was able to get the automation working exactly how I want it. The automation is triggered as soon as the temperature is set to a value below 77 degrees but it will wait 2 mins before resetting the temperature. It will also send an iOS notification when the action is executed.

- id: CORTEMP-04
  alias: Set COR Temp To 77 Degrees
  trigger:
  - below: '77'
    entity_id: climate.my_home
    platform: numeric_state
    value_template: '{{ state.attributes.temperature }}'
  condition: []
  action:
  - delay: 00:02
  - data:
      entity_id: climate.my_home
      operation_mode: Cool
      temperature: 77
    service: climate.set_temperature
  - data:
      data:
        badge: 5
        push:
      message: COR thermostat has been reset to 77 degrees
      title: COR Thermostat
    service: notify.ios_markiphonex

Well done!

One suggestion I have is that you consider removing the delay from the action and adding a for to the trigger.

The following automation will trigger when the temperature is set below 77 for at least 2 minutes:

- id: CORTEMP-04
  alias: 'Set COR Temp To 77 Degrees'
  trigger:
  - platform: numeric_state
    entity_id: climate.my_home
    value_template: '{{ state.attributes.temperature }}'
    below: '77'
    for: '00:02:00'
  condition: []
  action:
  - service: climate.set_temperature
    data:
      entity_id: climate.my_home
      operation_mode: 'cool'
      temperature: 77
  - service: notify.ios_markiphonex
    data:
      data:
        badge: 5
        push:
      message: COR thermostat has been reset to 77 degrees
      title: COR Thermostat
2 Likes

Thank you, pretty nice. I updated the automation with your suggestion and it works great.