Created
February 24, 2022 19:19
-
-
Save sillvva/0cc866270ccd1fb4ca653bc9221139a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias: 'Notification: Packages Delivered' | |
description: '' | |
trigger: | |
- platform: state | |
entity_id: sensor.mail_fedex_delivered | |
from: '0' | |
id: Fedex | |
- platform: state | |
entity_id: sensor.mail_ups_delivered | |
from: '0' | |
id: UPS | |
- platform: state | |
entity_id: sensor.mail_usps_delivered | |
from: '0' | |
id: USPS | |
- platform: state | |
entity_id: sensor.mail_usps_mail | |
id: Mail | |
from: '0' | |
condition: [] | |
action: | |
- choose: | |
- conditions: | |
- condition: trigger | |
id: Mail | |
- condition: template | |
value_template: >- | |
{{ is_number(states("sensor.mail_usps_mail")) and | |
int(states("sensor.mail_usps_mail")) > 0 }} | |
sequence: | |
- service: script.send_actionable_notifications | |
data: | |
notification_title: Mail | |
notification_message: You've got mail! | |
- conditions: | |
- condition: template | |
value_template: >- | |
{{ is_number(states("sensor.mail_" + trigger.id.lower() + | |
"_delivered")) and int(states("sensor.mail_" + trigger.id.lower() | |
+ "_delivered")) > 0 }} | |
sequence: | |
- service: script.send_actionable_notifications | |
data: | |
notification_title: Delivery | |
notification_message: >- | |
{{ iif(states("sensor.mail_" + trigger.id.lower() + | |
"_delivered") == "1", "A package has", states("sensor.mail_" + | |
trigger.id.lower() + "_delivered") + " packages have") }} | |
arrived from {{ iif(trigger.id == 'USPS', 'the post office', | |
trigger.id) }}. | |
default: [] | |
mode: single |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment