#Variables in triggers?

1 messages · Page 1 of 1 (latest)

next fulcrum
#

Hello! I'm working on an automation for my thermostat.
I have a target temperature I want to aim for. So when the temperature drops aabove this value, turn off for instance.
I reference that value elsewhere in "choose" conditions for actions.
I'd like to be able to set the value once in the "Triggers" section, and have it read throughout the automation. This value would be static and only changed when the automation itself is edited.

Can someone point me in the right direction for this? It sounds like I should be making a "Trigger variable" https://www.home-assistant.io/docs/automation/trigger/#trigger-variables but I couldn't seem to get it to work. It almost sounded like I needed to make my own blueprint for myself? That seemed a little excessive just to define a number to be used throughout an automation.

Thanks in advance!

description: ""
trigger_variables:
  target_temp: 68
triggers:
  - trigger: numeric_state
    entity_id:
      - sensor.average_temperature_inside_excluding_extremities
    for:
      hours: 0
      minutes: 5
      seconds: 0
    above: "{{ target_temp }}"
    id: hot```
> Message malformed: expected float for dictionary value @ data['above']
modern bronze
#

The problem is that you can't use a template there

#

The most straightforward way to do it is to create an input_number helper and reference it there

#

Then change the value of the helper to whatever you want

#

Alternately, use a template trigger

#

{{ states('sensor.whatever')|float(0) > target_temp }}