I have a pair of automations to control my thermostat set temp, one triggers when a group of devices switches from home to not_home and the other triggers when the same group goes from not_home to home. The problem is, even though I can see it fire it is no longer setting the temperature. I need some help figuring out what the issue is.
Here is the automation when the devices leave.
alias: Temp Set Away
trigger:
platform: state
entity_id: group.thermostatdevices
from: 'home'
to: 'not_home'
action:
- service: climate.set_temperature
data_template:
entity_id: all
temperature: >-
{% if is_state_attr('climate.sensi', 'operation_mode', 'heat') -%}
{{ state_attr('climate.sensi', 'temperature')|int(71) - 3 }}
{% elif is_state_attr('climate.sensi', 'operation_mode', 'cool') -%}
{{ state_attr('climate.sensi', 'temperature')|int(73) + 3 }}
{%- else -%}
{{ state_attr('climate.sensi', 'temperature')|int(73) }}
{%- endif %}
target_temp_low: >-
{% if is_state_attr('climate.sensi', 'operation_mode', 'auto') -%}
{{ state_attr('climate.sensi', 'target_temp_low')|int(71) - 3 }}
{%- else -%}
{{ state_attr('climate.sensi', 'target_temp_low')|int(71) }}
{%- endif %}
target_temp_high: >-
{% if is_state_attr('climate.sensi', 'operation_mode', 'auto') -%}
{{ state_attr('climate.sensi', 'target_temp_high')|int(73) + 3 }}
{%- else -%}
{{ state_attr('climate.sensi', 'target_temp_low')|int(73) }}
{%- endif %}
- service: notify.pushbullet
data:
title: 'Thermostat set temp changed due to devices leaving home'
message: ''
Here is the automation when they return
alias: Temp Set Home
trigger:
platform: state
entity_id: group.thermostatdevices
from: 'not_home'
to: 'home'
action:
- service: climate.set_temperature
data_template:
entity_id: all
temperature: >-
{% if is_state_attr('climate.sensi', 'operation_mode', 'heat') -%}
{{ state_attr('climate.sensi', 'temperature')|int(71) + 3 }}
{% elif is_state_attr('climate.sensi', 'operation_mode', 'cool') -%}
{{ state_attr('climate.sensi', 'temperature')|int(73) - 3 }}
{%- else -%}
{{ state_attr('climate.sensi', 'temperature')|int(73) }}
{%- endif %}
target_temp_low: >-
{% if is_state_attr('climate.sensi', 'operation_mode', 'auto') -%}
{{ state_attr('climate.sensi', 'target_temp_low')|int(71) + 3 }}
{%- else -%}
{{ state_attr('climate.sensi', 'target_temp_low')|int(71) }}
{%- endif %}
target_temp_high: >-
{% if is_state_attr('climate.sensi', 'operation_mode', 'auto') -%}
{{ state_attr('climate.sensi', 'target_temp_high')|int(73) - 3 }}
{%- else -%}
{{ state_attr('climate.sensi', 'target_temp_low')|int(73) }}
{%- endif %}
- service: notify.pushbullet
data:
title: 'Thermostat set temp changed due to devices arriving home'
message: ''