All,
Hi, I am currently using @pinkywafer’s anniversaries integration. I have written a blueprint to be able to receive notification for these anniversaries. The idea is that it selected all sensors with sensor.anniversary_ and checks how many days left.
Still learning and below doesn’t seem to work yet. Anybody that can help to fix/finalize this?
Thanks!
blueprint:
name: Anniversary notification
description: Anniversary notification for custom integration anniversary sensors (sensor.anniversary_<name>)
domain: automation
input:
threshold:
name: Anniversary sensor threshold
description: How many days in advantage to receive a notification
default: 0
selector:
number:
min: 0
max: 7
unit_of_measurement: 'days'
mode: slider
step: 1.0
time:
name: When?
description: Time to reveice a notification
default: '08:00:00'
selector:
time: {}
day:
name: Weekday to check on
description: 'Run at configured days either everyday (0) or on a given (1: Monday ... 7: Sunday)'
default: 0
selector:
number:
min: 0.0
max: 7.0
mode: slider
step: 1.0
actions:
name: Actions
description: Notifications or similar to be run. {{sensors}} is replaced with the anniversary names.
selector:
action: {}
variables:
day: !input 'day'
threshold: !input 'threshold'
sensors: >-
{% set result = namespace(sensors=[]) %}
{% for state in states.sensor if 'sensor.anniversary_' in state.entity_id %}
{% if 0 <= state.state | int(-1) < threshold | int %}
{% set result.sensors = result.sensors + [state.name ~ ' (' ~ state.state ~ ' %)'] %}
{% endif %}
{% endfor %}
{{result.sensors|join(', ')}}
trigger:
- platform: time
at: !input 'time'
condition:
- condition: template
value_template: '{{ sensors != '''' and (day | int == 0 or day | int == now().isoweekday()) }}'
action:
- choose: []
default: !input 'actions'
mode: single