QQ Send a notification when the outside temperature is less than inside, or vice versa

I just want a simple notification or action (blink the lights 3 times) when the temperature outside falls below the one inside, so I can open the window. Then again, in the morning, when it gets higher than inside. Ideally I can set a 1-2 degree threshold. Should be relatively easy to do, but I haven’t figured it out.

What I have so far in triggers, as yaml:

platform: state
entity_id: sensor.nexus_channel_2_temperature
from: '23'

That’s the outside sensor, the inside one is pretty similar.

What I have as action:

repeat:
  count: '3'
  sequence:
    - service: light.turn_on
      data:
        flash: short
        kelvin: 3200
        brightness: 1
      target:
        entity_id: light.panel_1_2
    - delay:
        hours: 0
        minutes: 0
        seconds: 3
        milliseconds: 500

You might use a trigger template

automation:
  trigger:
    - platform: template
      value_template: "{% if states('sensor.inside_temp')|float > states('sensor.outside_temp')|float %}true{% endif %}"

To be expanded with your desired logic, ofc.

1 Like

Just to expand, for future users, here is my automation “config”. It was done mostly visually, but someone can figure out what the settings are:

id: '1623978887079'
alias: 'Inside is warmer: open windows'
description: ''
trigger:
  - platform: template
    value_template: >-
      {% if states('sensor.nexus_channel_1_temperature')|float >
      states('sensor.nexus_channel_2_temperature')|float + 0.7 %}true{% endif %}
    id: inside_warmer
condition:
  - condition: time
    after: '16:00'
    before: '23:59'
  - condition: numeric_state
    entity_id: sensor.nexus_channel_2_temperature
    above: '10'
action:
  - repeat:
      count: '2'
      sequence:
        - service: light.turn_on
          data:
            kelvin: 3200
            brightness_pct: 1
            flash: short
            transition: 1
          target:
            entity_id: light.panel_1_2
        - delay:
            hours: 0
            minutes: 0
            seconds: 3
            milliseconds: 500
mode: single
max: 5

Note that the “max” and “transition” properties are not needed, they are just junk left behind by the visual configuration.
I had to add a condition to check if the outside temperature is above 10, since the sensor sometimes becomes “unavailable” which translates to 0.0 when converted to float.
Another condition just checks that the time is right, 4pm to 12am. The action flashes a light twice.

There is a similar automation for closing the windows in the morning, it flashes the light 3 times, with a similar time condition. No need for a zero-check there.