Automation If Trigger

Hello guys,

I think I need a little bit of input. I searched a lot on google but I didn’t find anything close that could save my problem.
I think it will be easy for you, thanks for the help.
I want to trigger an automation which send me a telegram notification when the temperature outside is lower then inside.

alias: OpenWeather Temp Outside Telegram (wSensor)
description: ''
trigger:
  - platform: numeric_state
    entity_id: sensor.openweathermap_temperature
    below: -1
    value_template: "{{ state.sensor.openweathermap_temperature - state.sensor.lumi_lumi_weather_temperature }}"
condition: []
action:
  - service: notify.marceltelegram
    data:
      message: Temp Out 1°C lower
      title: '*~~Weather~~*'
mode: single

Is this the way to go?

automation:
  trigger:
    - platform: numeric_state
      entity_id: sensor.outside_temperature
      below: sensor.inside_temperature

It’s basically the 4th example here: https://www.home-assistant.io/docs/automation/trigger/#numeric-state-trigger

2 Likes

It’s basically the 4th example here: Automation Trigger - Home Assistant

This is what I already found, but I want to trigger it with a temperature delta of 1 °C between these two temps.
I did edit my first post, is this a solution?

then use a template trigger (also your template was wrong):

trigger:
  - platform: template
    value_template: "{{ states('sensor.openweathermap_temperature') | int - states('sensor.lumi_lumi_weather_temperature') | int > 0 }}"
2 Likes

Its still not working, I changed int to float cause the values are decimal numbers

alias: OpenWeather Temp Outside Telegram (wSensor) V2
description: ''
trigger:
  - platform: template
    value_template: "{{ states('sensor.lumi_lumi_weather_temperature') | float - states('sensor.openweathermap_temperature') | float > 1 }}"
condition: []
action:
  - service: notify.marceltelegram
    data:
      title: '*~~Weather Template V2~~*'
      message: Temp 1°C lower
mode: single

You seem to have dropped the quotes around the template that finity had. You need to add those back or else make it a yaml multiline string.

1 Like

You are right, ahhh these little mistakes.
Thx to all for the help :beers:

Solution by @finity

alias: OpenWeather Temp Outside Telegram (wSensor) V2
description: ''
trigger:
  - platform: template
    value_template: "{{ states('sensor.lumi_lumi_weather_temperature') | float - states('sensor.openweathermap_temperature') | float > 1 }}"
condition: []
action:
  - service: notify.marceltelegram
    data:
      title: '*~~Weather Template V2~~*'
      message: Temp 1°C lower
mode: single

While I’m not too worried about it myself (but others tend to be) it’s customary to mark the post of the person who provided you with the solution with the “solution” tag and not your own post.

Just an etiquette FYI.

1 Like

FAQ guideline 21

Mark the post that identified the cause of the problem and/or suggested a corrective measure.

1 Like

@finity I know but should I mark this as a solution?

You seem to have dropped the quotes around the template that finity had. You need to add those back or else make it a yaml multiline string.

I did an edit of the Solution, I hope its fine now

it honestly really doesn’t matter to me.

1 Like