Automation - Temperature Trigger template not working

Hi All,

I’m new to home automation and I’m trying to create an automation to turn on a power point if the Outdoor temperature is higher than the temperature in my outdoor fish tank.

If I check the template trigger in the Developer Tools it reports True so I have no idea why it’s not actually triggering :frowning:

This is the automation I’ve created, any thoughts would be greatly appreciated

alias: Solar Pump (Turn on)

description: ""
trigger:
  - platform: template
    value_template: >-
      value_template: {{states("sensor.outdoor_temperature")|float(0) >
      state_attr('climate.itc_308_wifi_aquaponics',
      'current_temperature')|float(0) >1 }}
    for: "00:01:00"
condition: []
action:
  - service: climate.set_temperature
    data:
      temperature: 25
    target:
      entity_id: climate.itc_308_wifi_aquaponics
  - service: notify.mobile_app_iphone
    data:
      message: >-
        Water Temp
        {{state_attr('climate.itc_308_wifi_aquaponics','current_temperature')}}
        Outdoor Temp {{ states("sensor.outdoor_temperature") }}
      title: Pump turned on
mode: single

You have an extraneous value_template:

Also, as explained in the docs:

Template triggers work by evaluating a template when any of the recognized entities change state. The trigger will fire if the state change caused the template to render ‘true’ when it was previously ‘false’.

If your template already renders “true” when you save/initialize the automation, it will not cause the actions to be executed. Triggering require the template’s rendered value to change from “false” to “true”.

Thanks, I’ve removed the extra value_template, but it’s still not triggering even though the condition is true.

The template was false overnight and has just turned true as the sun comes up

alias: Solar Pump (Turn on)
description: ""
trigger:
  - platform: template
    value_template: >-
      value_template: {{states("sensor.outdoor_temperature")|float(0) >
      state_attr('climate.itc_308_wifi_aquaponics',
      'current_temperature')|float(0) >1 }}
    for: "00:01:00"
condition: []
action:
  - service: climate.set_temperature
    data:
      temperature: 25
    target:
      entity_id: climate.itc_308_wifi_aquaponics
  - service: notify.mobile_app_iphone
    data:
      message: >-
        Water Temp
        {{state_attr('climate.itc_308_wifi_aquaponics','current_temperature')}}
        Outdoor Temp {{ states("sensor.outdoor_temperature") }}
      title: Pump turned on
mode: single

This is the output from the dev tools

value_template: {{states("sensor.outdoor_temperature")|float(0) >
      state_attr('climate.itc_308_wifi_aquaponics',
      'current_temperature')|float(0) >1 }}

Water Temp
        Water Temp {{state_attr('climate.itc_308_wifi_aquaponics','current_temperature')}}
        Outdoor Temp {{ states("sensor.outdoor_temperature") }}


value_template: True

Water Temp
Water Temp 19.4
Outdoor Temp 23.28

Are you sure… it’s still in the copy you pasted the second time.

I don’t see any other glaring issues. The only other thing that comes to mind would be to make sure the hvac mode of the climate entity is properly set.

  - platform: template
    value_template: >-
      {{ states('sensor.outdoor_temperature')|float(0) >
        state_attr('climate.itc_308_wifi_aquaponics', 'current_temperature')|float(0) }}
    for: "00:01:00"