Keep Nest thermostats at safe levels with notifications

I have recently tablet on a wall with HA running, the interface allows my kids and guest to interact with the home thermostats (we have two nest).

The other day I found the kids had lowered one of the thermostat to 64 F, which was not a problem because it was in heat mode and the home was already above 64 so nothing happened. But it got me thinking … what if they raised it up to 78 or 80 or in cooling mode to 64 or 60?

That inspired to write an automation to maintain safe ranges and also to notify me when settings are outside of what I consider sane ranges.

This automation and script, will notify via alexa and a message to your phone, then it will proceed to reset the temperature to a safe number.

This automation / script will work regardless of where the temperature change was made. From a tablet, device it self, etc.

Hope this helps someone.

Automation:

- id: alert-when-thermostat-is-outside-ranges
  alias: Alert when temps are set outside of ranges
  trigger:
    - platform: numeric_state
      entity_id: climate.downstairs_thermostat
      value_template: "{{ state.attributes.temperature }}"
      below: 68
    - platform: numeric_state
      entity_id: climate.downstairs_thermostat
      value_template: "{{ state.attributes.temperature }}"
      above: 70
    - platform: numeric_state
      entity_id: climate.upstairs_thermostat
      value_template: "{{ state.attributes.temperature }}"
      below: 68
    - platform: numeric_state
      entity_id: climate.upstairs_thermostat
      value_template: "{{ state.attributes.temperature }}"
      above: 70
  action:
    - service: notify.mobile_app_your_phone
      data_template:
        title: "Temperature set outside of range"
        message: "Warning, temperature on {{ trigger.to_state.attributes.friendly_name }} set outside of allowed range (67 <=> 71)"
        data:
          subtitle: "Currently set to  {{ trigger.to_state.attributes.temperature }}"
    - service: script.turn_on
      entity_id: script.alexa_warn_temp_settings
    - delay:
        seconds: 10
    - service: climate.set_temperature
      data_template:
        entity_id: "{{trigger.entity_id}}"
        temperature: 68

Script:

alexa_warn_temp_settings:
  alias: Alexa warn when temp is out of range
  sequence:
  - data:
      data:
        type: announce
      message: "Warning, temperature should be between 67 and 71 degrees. Please set accordingly."
      target:
      - media_player.your_echo_device
    service: notify.alexa_media
1 Like

Put the tablet higher on the wall so the kids cannot reach it :slight_smile:

@nickrout my son is 13 and is 5’ 9 (69 inches) he’s catching up quickly.

LOL old enough to know better than to screw with the thermostat.