Best way to create this automation: If outside temperature sensor is 2 degrees less than a room temperature, send message to open window, but only send once

Hey all,

Ive been debating the most efficient way to create this automation to remind me to open a window for my office if its cooler in my backyard in the evenings. The thing is, I dont want to get spammed, I just need that one notification. I was thinking about doing it like this at the moment but it feels a bit inefficient.

  1. Create input_boolean
  2. Automation 1: If temperature outside is cooler than room temperature by 2 degrees or more, set input_boolean to true.
  3. Automation 2: If input_boolean is set to true, send push notification and disable automation 1.
  4. Automation 3: Reset input_boolean to off at sunsett and reset automation 1 back to enabled.

Maybe there’s a decent way to combine this into just one automation?

Do you have a window sensor?

If so…

  mode: single
    (temp_out - 2) < temp_in for 10 mins
    time range
    window is closed
    sun is up
    user is home
  send message
  wait timer
      60 mins for window to open (automation stays running)
      (by then the temp trend should be low enough not to trigger the automation again)

I think that should work, I went with this… I havent used the wait timer before!

alias: 'Notification: Office Window'
description: ''
  - platform: numeric_state
    entity_id: sensor.office_temperature
    above: sensor.acurite_tower_a_6432_t_side
    for: '00:10:00'
  - condition: state
    state: home
  - condition: state
    entity_id: binary_sensor.officewindow_contact_sensor
    state: 'off'
  - condition: time
    after: '17:00'
    before: '23:59'
  - service: notify.mobile_app_phone
      message: Open office window
  - wait_for_trigger:
      - platform: state
        entity_id: binary_sensor.officewindow_contact_sensor
        from: 'off'
        to: 'on'
        for: '00:60:00'
    continue_on_timeout: false
    timeout: '00:60:00'
mode: single

If you have humidity detection also, I would base some of the window opening off of Dew Point.

1 Like