hello all,
I have an automation setup which utilizes a helper (mail counter), a binary door/window sensor, and USPS informed delivery integration. the amount of times the mailbox is opened is stored in the counter. the automation’s purpose is to send my wife and I an email everyday when the mail comes with the embedded scans of the mail items. The mailbox being opened once triggers this. The second time the box is open, it emails my wife and I that someone brought in the mail. Any further mailbox opening is ignored, and it resets at sunrise.
I used to accomplish this with 3 or 4 automations, and I recently tried to take advantage of trigger IDs to combine it, but the mail counter helper never resets, so it gets stuck at “3” and the automation stops sending notifications.
I’ve tried using a static time (5am) as a trigger, and moving the triggers and actions around, and can’t figure out a working combination. is this possible in this manner, or will I need a separate automation just to reset the helper?
- id: '1647196856842'
alias: snail mail to email
description: ''
trigger:
- platform: state
entity_id: binary_sensor.snail_mail
to: 'on'
id: mailbox open
- platform: sun
event: sunrise
offset: 0
id: 5AM
condition: []
action:
- condition: trigger
id: mailbox open
- service: counter.increment
data: {}
target:
entity_id: counter.mail_helper
- condition: trigger
id: 5AM
- service: counter.reset
data: {}
target:
entity_id: counter.mail_helper
- choose:
- conditions:
- condition: state
entity_id: counter.mail_helper
state: '1'
sequence:
- data_template:
data:
html: '<img src="{{ states.sensor.mail_image_url.state }}">
'
message: snail mail has arrived
title: snail mail has arrived
service: notify.email
- conditions:
- condition: state
entity_id: counter.mail_helper
state: '2'
sequence:
- service: notify.email
data:
message: someone has brought in the mail
title: snail mail update
default: []
mode: parallel
max: 4
thank you for your help!