Script that has execution condition only if the temperature is higher ">" 25

Dear, I’m trying to create a script that has a condition of execution that is> 25 degrees.

I’ll call the script whenever I get home. My difficulty is in the model I have to do.

trigger:
     platform: template
     value_template: "{{(states.sensor.sensor.yweather_temperature | float)> 25)}}"

Here’s one that I use that works:

trigger:
  platform: template
  value_template: '{{ states.sensor.ssl_cert_expiry.state | int < 21 }}'

Also be sure to properly format your code when posting things to the forum. See the blue box at the top for instructions.

it helps to see formatting/syntax issues.

1 Like

Thanks for the answer.

But it has to be a non-triggered execution condition.

I’m not sure I follow what that means…

Try:

- alias: Whatever
  trigger:
    # Put your "I got home" trigger here
  condition:
    condition: numeric_state
    entity_id: sensor.yweather_temperature
    above: 25
  action:
    # Put your action(s) here

I want to make a condition. I do not want to trigger …

That is, the scritp will be called. And it will only run if the condition is met. that is, if the temperature is> 25 degrees.

Oh, you want this in a script?

Ok, try this:

script:
  my_script:
    sequence:
      - condition: numeric_state
        entity_id: sensor.yweather_temperature
        above: 25
      - # Additional steps go here
1 Like

boy,
You’re always great. I confess that when posting I was hoping for you to appear.

Thank you! You’re very good at programming.

Thanks. I’ve been doing it for 40 years; I hope I’ve picked up some tricks along the way! :wink:

Glad I could help.

1 Like

Thunderbird Two was always reliable!

3 Likes