From 06173d48630a265e30004bd0f354e9b317467da8 Mon Sep 17 00:00:00 2001 From: Carlo Costanzo Date: Fri, 29 May 2026 17:10:00 -0400 Subject: [PATCH] Debounce fridge door open alerts --- config/packages/README.md | 1 + config/packages/blink.yaml | 17 ++++---------- config/packages/fridge.yaml | 33 +++++++++++++++++---------- config/templates/speech/briefing.yaml | 12 +++++++--- 4 files changed, 36 insertions(+), 27 deletions(-) diff --git a/config/packages/README.md b/config/packages/README.md index a286db98..ac063020 100755 --- a/config/packages/README.md +++ b/config/packages/README.md @@ -40,6 +40,7 @@ Live collection of plug-and-play Home Assistant packages. Each YAML file in this | --- | --- | --- | | [alarm.yaml](alarm.yaml) | NodeMCU-powered perimeter monitoring with arm/disarm helpers and rich notifications. | `binary_sensor.mcu*_gpio*`, `group.family`, notify + siren scripts | | [alexa_media_player.yaml](alexa_media_player.yaml) | Alexa Media helper sensors including stable bedroom wake-alarm wrappers for Carlo and Stacey plus a combined next-wake view. | `sensor.last_alexa`, `sensor.bedroom_next_wake_alarm`, `sensor.bedroom_next_wake_alarm_source`, `binary_sensor.bedroom_next_wake_alarm_active` | +| [fridge.yaml](fridge.yaml) | SmartThinQ fridge monitoring with a confirmed-open door helper so short status-refresh pulses do not trigger alerts or speech. | `binary_sensor.refrigerator_door_open`, `binary_sensor.refrigerator_door_confirmed_open`, `script.notify_engine`, `script.speech_engine` | | [garadget.yaml](garadget.yaml) | MQTT-based control + status for both garage doors, feeding entry/exit lighting routines. | `cover.large_garage_door`, `cover.small_garage_door`, `sensor.garadget_reflection` | | [august.yaml](august.yaml) | Front-door August smart lock with Alexa Show camera pop-up when unlocked. | `lock.front_door`, media_player actions for front doorbell camera | | [holiday.yaml](holiday.yaml) | REST-driven US holiday + flag sensors that color scenes and exterior lighting. | `sensor.holiday`, `sensor.flag`, JSON feed at `config/json_data/holidays.json` | diff --git a/config/packages/blink.yaml b/config/packages/blink.yaml index 76e43b34..18f5d214 100755 --- a/config/packages/blink.yaml +++ b/config/packages/blink.yaml @@ -18,11 +18,6 @@ automation: above: 60 for: minutes: 20 - - platform: state - entity_id: binary_sensor.refrigerator_door_open - to: 'on' - for: - minutes: 10 - platform: event event_type: event_fridge_still_hot_loop @@ -34,7 +29,7 @@ automation: above: 60 - condition: state - entity_id: binary_sensor.refrigerator_door_open + entity_id: binary_sensor.refrigerator_door_confirmed_open state: 'on' action: @@ -44,19 +39,17 @@ automation: value1: > {% if trigger.platform == 'numeric_state' %} The Blink camera temperature sensor has detected {{ states('sensor.blink_blink1_temperature') }} degrees for over 20 minutes. - {% elif trigger.platform == 'binary_sensor' and trigger.entity_id == 'binary_sensor.refrigerator_door_open' %} - The fridge door has been open for over 10 minutes. + {% elif is_state('binary_sensor.refrigerator_door_confirmed_open', 'on') %} + The SmartThinQ fridge door sensor is still confirmed open, and the Blink camera temperature is {{ states('sensor.blink_blink1_temperature') }} degrees. {% else %} - The fridge is still hot after the previous alert. The fridge temperature is {{ states('sensor.blink_blink1_temperature') }} degrees. {% if is_state('binary_sensor.refrigerator_door_open', 'on') %}The fridge door is currently open.{% endif %} + The fridge is still hot after the previous alert. The fridge temperature is {{ states('sensor.blink_blink1_temperature') }} degrees. {% endif %} who: 'family' group: 'information' - - wait_template: "{{ states.group.family.state == 'home' }}" - - service: script.speech_engine data: - value1: "Please check the fridge. The fridge temperature is {{ states('sensor.blink_blink1_temperature') }} degrees for over 20 minutes. {% if is_state('binary_sensor.refrigerator_door_open', 'on') %}The fridge door is currently open.{% endif %}" + value1: "Please check the fridge. The Blink camera temperature is {{ states('sensor.blink_blink1_temperature') }} degrees. {% if is_state('binary_sensor.refrigerator_door_confirmed_open', 'on') %}The SmartThinQ fridge door sensor is confirmed open.{% endif %}" no_fridge: 1 - delay: 00:30:00 diff --git a/config/packages/fridge.yaml b/config/packages/fridge.yaml index 44e70846..a014d7e0 100644 --- a/config/packages/fridge.yaml +++ b/config/packages/fridge.yaml @@ -4,37 +4,46 @@ # Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig # ------------------------------------------------------------------- # LG Fridge - SmartThinQ appliance monitoring - Fridge/freezer sensors via ThinQ integration. https://amzn.to/3lOYTCv. -# Centralizes the LG Fridge - SmartThinQ appliance monitoring package configuration and helpers. +# Debounces SmartThinQ door-open telemetry before fridge alerts and speech use it. # ------------------------------------------------------------------- +# Notes: SmartThinQ can briefly report the door open during appliance status refreshes; alerts use the confirmed helper below. ###################################################################### +template: + - binary_sensor: + - name: "Refrigerator door confirmed open" + unique_id: refrigerator_door_confirmed_open + device_class: door + availability: "{{ states('binary_sensor.refrigerator_door_open') not in ['unknown', 'unavailable', 'none', ''] }}" + state: "{{ is_state('binary_sensor.refrigerator_door_open', 'on') }}" + delay_on: + minutes: 10 + delay_off: + seconds: 30 + attributes: + raw_sensor: binary_sensor.refrigerator_door_open + raw_state: "{{ states('binary_sensor.refrigerator_door_open') }}" + automation: - alias: 'Fridge Door Open' id: 2346efcd-e8a8-4e86-b5b6-43eBl1nkFr1dge95D00r0pen mode: single trigger: - platform: state - entity_id: binary_sensor.refrigerator_door_open + entity_id: binary_sensor.refrigerator_door_confirmed_open to: 'on' - for: - minutes: 5 condition: - condition: state - entity_id: binary_sensor.refrigerator_door_open + entity_id: binary_sensor.refrigerator_door_confirmed_open state: 'on' action: - service: script.notify_engine data: title: 'Fridge Door Open' value1: > - The fridge door has been open for more than 5 minutes. Please check and close the fridge door to avoid temperature issues. + The SmartThinQ fridge door sensor has been confirmed open for more than 10 minutes. Please check and close the fridge door to avoid temperature issues. who: 'family' group: 'information' - - wait_template: "{{ states.group.family.state == 'home' }}" - - service: script.speech_engine data: - value1: "[Tell Household the Fridge Door is Open for more than 5 minutes]" - - - delay: 00:30:00 - - event: event_fridge_door_open + value1: "[Tell Household the Fridge Door is Open for more than 10 minutes]" diff --git a/config/templates/speech/briefing.yaml b/config/templates/speech/briefing.yaml index a666386c..022a3afd 100755 --- a/config/templates/speech/briefing.yaml +++ b/config/templates/speech/briefing.yaml @@ -88,11 +88,14 @@ {%- macro fridge() -%} {% set freezer = states('sensor.refrigerator_freezer_temp') %} {% set fridge = states('sensor.refrigerator_fridge_temp') %} - The internal temperature of the refrigerator is currently {{ states('sensor.blink_blink1_temperature') }} degrees. + {% set blink_temp = states('sensor.blink_blink1_temperature') %} + {% if blink_temp not in ['unknown', 'unavailable', 'none', ''] %} + The internal temperature of the refrigerator is currently {{ blink_temp }} degrees. + {% endif %} {% if freezer not in ['unknown', 'unavailable', 'none', ''] and fridge not in ['unknown', 'unavailable', 'none', ''] %} The freezer temperature is {{ freezer }} degrees and the fridge temperature is {{ fridge }} degrees. {% endif %} - {% if is_state('binary_sensor.refrigerator_door_open', 'on') %}The fridge door is currently open.{% endif %} + {% if is_state('binary_sensor.refrigerator_door_confirmed_open', 'on') %}The fridge door is confirmed open.{% endif %} {%- endmacro -%} {%- macro window_check() -%} @@ -291,7 +294,10 @@ {{ lightning() }} {% endif %} - {% if (states('sensor.blink_blink1_temperature')|int(0) > 55 or states('sensor.refrigerator_freezer_temp')|float > 5 or states('sensor.refrigerator_fridge_temp')|float > 50 or is_state('binary_sensor.refrigerator_door_open', 'on')) and no_fridge != 1 %} + {% set blink_temp = states('sensor.blink_blink1_temperature') | float(none) %} + {% set freezer_temp = states('sensor.refrigerator_freezer_temp') | float(none) %} + {% set fridge_temp = states('sensor.refrigerator_fridge_temp') | float(none) %} + {% if ((blink_temp is not none and blink_temp > 55) or (freezer_temp is not none and freezer_temp > 5) or (fridge_temp is not none and fridge_temp > 50) or is_state('binary_sensor.refrigerator_door_confirmed_open', 'on')) and no_fridge != 1 %} {{ fridge() }} {% endif %}