Remember returned bins and confirm garage arrivals

master
Carlo Costanzo 1 day ago
parent 66a98d065d
commit 3351076930

@ -23,7 +23,9 @@
# need air, even outside garbage days or during a garbage-only snooze.
# Tire speech uses the existing 1-day/3-day tire-alert snooze.
# Notes: Local garage classifiers suppress garbage reminders once the
# required bins are absent. Unknown/obstructed views retain reminders.
# required bins are absent. Pending take-out alerts allow 20 extra seconds
# for the camera to confirm the view after the door opens. Unknown or
# obstructed views still produce a reminder when the wait expires.
# Notes: Bring-in checks start with Monday/Thursday morning garage
# openings, continuing on following days until the next take-out day.
# Each bin stops appearing once verified stored. Timing is a household
@ -84,6 +86,13 @@
- condition: trigger
id: garage_open
- alias: "Allow one more camera check before a take-out reminder"
wait_template: >-
{% from 'garbage_bins.jinja' import garbage_takeout_reminder %}
{{ garbage_takeout_reminder() | trim == '' }}
timeout: "00:00:20"
continue_on_timeout: true
- variables:
reminder_delays: [30, 60, 90] # cumulative delays to hit 30s, 90s, 180s
reminder_message: >-

@ -46,13 +46,29 @@
{%- endif -%}
{%- endmacro %}
{# Return timestamps persist across restarts and expire at the next collection cycle. #}
{% macro garbage_return_recorded(entity_id, current_time=none) -%}
{%- set current = current_time if current_time is not none else now() -%}
{%- set weekday = current.weekday() -%}
{%- if weekday in [0, 1, 3, 4, 5] -%}
{%- set days_since_pickup = weekday if weekday < 3 else weekday - 3 -%}
{%- set cycle_start = current.replace(hour=8, minute=0, second=0, microsecond=0) - timedelta(days=days_since_pickup) -%}
{{- state_attr(entity_id, 'hour') | int(0) >= 8
and state_attr(entity_id, 'timestamp') | float(0) >= as_timestamp(cycle_start) -}}
{%- else -%}
false
{%- endif -%}
{%- endmacro %}
{% macro garbage_return_reminder(include_recycling=true) -%}
{%- if is_state('timer.garbage_reminder_snooze', 'idle') -%}
{%- set ns = namespace(needed=[]) -%}
{%- if not is_state('binary_sensor.garage_garbage_at_curb', 'off') -%}
{%- if not is_state('binary_sensor.garage_garbage_at_curb', 'off')
and garbage_return_recorded('input_datetime.garage_garbage_last_returned') | trim | lower != 'true' -%}
{%- set ns.needed = ns.needed + ['garbage pail'] -%}
{%- endif -%}
{%- if include_recycling and not is_state('binary_sensor.garage_recycling_at_curb', 'off') -%}
{%- if include_recycling and not is_state('binary_sensor.garage_recycling_at_curb', 'off')
and garbage_return_recorded('input_datetime.garage_recycling_last_returned') | trim | lower != 'true' -%}
{%- set ns.needed = ns.needed + ['recycling containers'] -%}
{%- endif -%}
{%- if ns.needed -%}

@ -50,6 +50,14 @@ input_text:
max: 255
input_datetime:
garage_garbage_last_returned:
name: "Garage garbage last verified returned"
has_date: true
has_time: true
garage_recycling_last_returned:
name: "Garage recycling last verified returned"
has_date: true
has_time: true
front_door_package_last_sync:
name: "Frigate front door last state sync"
has_date: true
@ -120,6 +128,51 @@ template:
classifier_edge_state: "{{ states('sensor.frontdoorbell_front_door_package_edge_classification') }}"
automation:
- alias: Frigate - Remember garage bin returns
id: frigate_remember_garage_bin_returns
description: "Remember stable bin returns through the current collection cycle."
mode: restart
triggers:
- trigger: state
entity_id:
- binary_sensor.garage_garbage_at_curb
- binary_sensor.garage_recycling_at_curb
to: 'off'
for: "00:02:00"
- trigger: time
at: "08:02:00"
- trigger: homeassistant
event: start
id: startup
actions:
- if:
- condition: trigger
id: startup
then:
- delay: "00:02:00"
- condition: template
value_template: "{{ now().weekday() in [0, 1, 3, 4, 5] and now().hour >= 8 }}"
- repeat:
for_each:
- sensor: binary_sensor.garage_garbage_at_curb
remembered: input_datetime.garage_garbage_last_returned
- sensor: binary_sensor.garage_recycling_at_curb
remembered: input_datetime.garage_recycling_last_returned
sequence:
- if:
- condition: template
value_template: >-
{% from 'garbage_bins.jinja' import garbage_return_recorded %}
{{ is_state(repeat.item.sensor, 'off')
and (as_timestamp(now()) - as_timestamp(states[repeat.item.sensor].last_changed)) >= 120
and garbage_return_recorded(repeat.item.remembered) | trim | lower != 'true' }}
then:
- action: input_datetime.set_datetime
target:
entity_id: "{{ repeat.item.remembered }}"
data:
datetime: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}"
- alias: Frigate - Garage bins compatibility state
id: frigate_garage_bins_compatibility_state
description: "Keep existing kiosk consumers true only when today's required bins are verified out."

@ -23,6 +23,8 @@
# Token fix: https://www.vcloudinfo.com/2020/05/fixing-garadget-in-home-assistant.html
# Video: https://youtu.be/wFO0H5zgnzk
# Companion post: https://www.vcloudinfo.com/2026/05/home-assistant-garage-automations-arrival-alerts-tesla.html
# Garage lighting video: https://youtu.be/_BYzcyEduF8
# Garage lighting guide: https://www.vcloudinfo.com/2026/11/home-assistant-garage-lights-multiple-sensors.html
# Hardware: Garadget unit https://amzn.to/2jQLpVQ
######################################################################
@ -425,22 +427,38 @@ automation:
icon2: sfsymbols:calendar
######################################################################
## Automation: Auto-open Large Garage Door when someone comes home
## Automation: Auto-open Large Garage Door after a driving arrival
######################################################################
- alias: 'Auto Open Large Garage Door On Arrival'
id: 7e2b1c3a-4b1e-4b2a-9c1a-automated_garage_door
mode: single
trigger:
- platform: state
mode: parallel
triggers:
- trigger: state
entity_id:
- person.carlo
- person.stacey
from: 'driving'
to: 'home'
action:
- service: script.open_large_garage_door_if_ready
to:
- 'home'
- 'not_home'
actions:
# Life360 can stop reporting driving before the person enters the home zone.
- alias: Wait for this driver to leave the transient away state
wait_template: >-
{{ trigger.to_state.state == 'home' or not is_state(trigger.entity_id, 'not_home') }}
timeout: "00:01:00"
continue_on_timeout: false
- alias: Confirm this driver is home
condition: template
value_template: "{{ is_state(trigger.entity_id, 'home') }}"
- alias: Suppress duplicate requests while the garage status catches up
condition: state
entity_id: script.open_large_garage_door_if_ready
state: 'off'
for: "00:00:15"
- action: script.open_large_garage_door_if_ready
data:
person_name: "{{ trigger.to_state.entity_id.split('.')[1] }}"
person_name: "{{ trigger.entity_id.split('.')[1] }}"
######################################################################
## Entry helper prompt after arrival if auto-open didn’t fire.

@ -66,7 +66,7 @@ LLM Vision's provider/settings entries and HACS component are removed, along wit
[![Watch smarter garbage reminders](https://img.shields.io/badge/Watch-Smarter%20Garbage%20Reminders-FF0000?logo=youtube&logoColor=white)](https://youtu.be/zcCrtwcw-S4) [![Garbage reminders blog](https://img.shields.io/static/v1?label=vCloudInfo&message=Garbage%20Reminders&color=21759B&logo=wordpress&logoColor=white)](https://www.vcloudinfo.com/2026/10/home-assistant-frigate-garbage-bin-reminders.html)
Two separate local models classify the regular garbage pail and recycling containers. Each uses `stored`, `absent`, and `obstructed` labels, a 0.9 acceptance threshold, motion checks, a 15-second interval, and Frigate's three-observation consensus. Camera-specific crop coordinates belong in the private Frigate configuration; adapt them to the actual bin positions when copying this pattern.
Two separate local models classify the regular garbage pail and recycling containers. Each uses `stored`, `absent`, and `obstructed` labels, motion checks, a 15-second interval, and Frigate's three-observation consensus. The current acceptance thresholds are 0.75 for garbage and 0.8 for recycling. The garbage model uses infrared examples of the empty spot with the garage door closed. Camera-specific crop coordinates belong in the private Frigate configuration; adapt them to the actual bin positions when copying this pattern.
The household rule is explicit: bins absent from their usual garage storage position are assumed to be at the curb. This does not perform curb-camera verification. Recycling lids remaining on the floor count as containers absent, while containers holding cardboard or turned at an angle still count as stored. Include these cases when labeling real recordings.
@ -76,7 +76,7 @@ The household rule is explicit: bins absent from their usual garage storage posi
The shared `garbage_bins.jinja` macro names only bins that still need attention. Sunday checks garbage out; Wednesday checks garbage and recycling out. Monday checks garbage returned; Thursday checks both types returned. Return reminders are eligible from 08:00 to 21:00, including following days until the next take-out day. Pickup-day timing is a household reminder window, not evidence that a truck has collected the bins.
Verification is layered into the existing garage-open automation and shared speech briefing. The door must still open for 20 seconds, the phone recipient and snooze actions are unchanged, and garage repeats retain their 30/90/180-second cadence. No new reminder automation or clock schedule is added. Each repeat refreshes its wording: taking garbage out first on Wednesday leaves only recycling reminders; returning garbage first on Thursday also leaves only recycling. Verified completion stops further reminders. Unknown, offline, or obstructed views never establish a completed return. Tire-only garage reminders remain available.
Verification is layered into the existing garage-open automation and shared speech briefing. After the door has been open for 20 seconds, a pending take-out alert allows up to 20 more seconds for the camera to confirm the new view. The automation checks which bins still need attention before sending the phone notification or speaking. Garage repeats follow the initial alert at 30, 90, and 180 seconds. No new reminder automation or clock schedule is added. Each repeat refreshes its wording: taking garbage out first on Wednesday leaves only recycling reminders; returning garbage first on Thursday also leaves only recycling. During the return phase, a bin observed as stored for two minutes is remembered separately for that collection cycle, including across Home Assistant restarts. Subsequent camera errors do not restart that bin's return reminder. The next take-out day begins a new cycle; take-out decisions still use the current classifier. Verified completion stops further reminders. Unknown, offline, or obstructed views never establish a completed return. Tire-only garage reminders remain available.
Initial training uses a small private set of real historical crops, including day/night lighting, a parked car, an empty garage, people obstructing the view, and lids left behind. Calibration examples and classifier scores do not establish operational accuracy. Keep household images and models private. Validate a real take-out and return cycle for each bin type, partial Wednesday completion, obstructions, and camera/MQTT loss and recovery before treating the classifiers as proven.

Loading…
Cancel
Save

Powered by TurnKey Linux.