Skip to content

Instantly share code, notes, and snippets.

@nielswind
Last active May 28, 2022 10:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nielswind/a5163ba320769fb3b68364fbb8a7d1be to your computer and use it in GitHub Desktop.
Save nielswind/a5163ba320769fb3b68364fbb8a7d1be to your computer and use it in GitHub Desktop.
blueprint:
name: Garbage collection alert
description: Do action (alert) in case garbage collection is today at specific time
domain: automation
input:
time:
name: Time to test on
description: Test is run at configured time
default: '10:00:00'
selector:
time: {}
day:
name: Weekday to test on
description: 'Test is run at configured time either everyday (0) or on a given
weekday (1: Monday ... 7: Sunday)'
default: 0
selector:
number:
min: 0.0
max: 7.0
mode: slider
step: 1.0
exclude:
name: Excluded Garbage Collection
default: {entity_id: []}
selector:
target:
entity:
device_class: garbage_collection__schedule
actions:
name: Actions
description: Notifications or similar to be run. {{sensors}} is replaced with
the names of sensors being low on battery.
selector:
action: {}
source_url: https://gist.github.com/nielswind/a5163ba320769fb3b68364fbb8a7d1be
variables:
day: !input 'day'
exclude: !input 'exclude'
sensors: >-
{% set result = namespace(sensors=[]) %}
{% for state in states.sensor | selectattr('attributes.device_class', '==', 'garbage_collection__schedule') %}
{% if 0 == state.state | int and not state.entity_id in exclude.entity_id %}
{% set result.sensors = result.sensors + [state.name] %}
{% endif %}
{% endfor %}
{{result.sensors|join(', ')}}
trigger:
- platform: time
at: !input 'time'
condition:
- '{{ sensors != '''' and (day | int == 0 or day | int == now().isoweekday()) }}'
action:
- choose: []
default: !input 'actions'
mode: single
@nielswind
Copy link
Author

Reminders for garbage collection

Based on the great work from sbyx
https://gist.github.com/sbyx/1f6f434f0903b872b84c4302637d0890

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment