Skip to content

Instantly share code, notes, and snippets.

@Hooverjc
Last active March 25, 2024 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save Hooverjc/edf2c7962712a904e1238c6294781add to your computer and use it in GitHub Desktop.
Save Hooverjc/edf2c7962712a904e1238c6294781add to your computer and use it in GitHub Desktop.
blueprint:
name: Garbage reminder
domain: automation
input:
reminder_time:
name: Reminder time
description: At what time the day before do you want to be reminded
default: '18:00:00'
selector:
time: {}
day_offset:
name: Day offset
description: Amount of days to be added to the triggers date to check for sensor
value matches. E.g. 1 to be notified the day before or 0 for notification
on the garbage collection day.
default: 1
reminder_title:
name: Reminder title
description: Shown as title in the notification
default: Garbage reminder
reminder_message:
name: Reminder message
description: Accompanying text in the notification
default: 'The following garbage will be picked up tomorrow: '
notifier:
name: Notifier
description: Name of integration you prefer to use for notifications. E.g. notify.notify
default: notify.notify
variables:
reminder_title: !input 'reminder_title'
reminder_message: !input 'reminder_message'
day_offset: !input 'day_offset'
sensors_tomorrow: "{{ states.sensor | selectattr('attributes.device_class', 'equalto', 'garbage_collection__schedule') | selectattr('attributes.days', 'equalto', day_offset|int(0)) | map(attribute='attributes.friendly_name')| list | join(', ') }}"
trigger:
platform: time
at: !input 'reminder_time'
condition:
condition: template
value_template: "{{ sensors_tomorrow | length > 0 }}"
action:
service: !input 'notifier'
data:
title: '{{ reminder_title }}'
message: '{{ reminder_message }}{{ sensors_tomorrow }}'
data:
ttl: 0
priority: high
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment