Hello,
I have some notifications that aren’t firing and I’m sure it’s because they’re all designed the same and I need some help to do what I need it to do.
Here’s the automation:
alias: Notification - 2nd Floor Filter Reminder
description: ''
trigger:
- platform: time
at: '12:00:00'
condition:
- condition: time
after: input_datetime.last_2nd_floor_filter_change
action:
- service: notify.mobile_app_serge_s_s9
data:
message: Replace 2nd floor vacuum filter
mode: single
What I want this to do:
at 12:00 each day, evaluate the input date for the next filter change. If today is greater than that date, send me a message. Do that again tomorrow at noon if the input date is still in the past.
Example:
At noon, check the 2nd floor input date, if the input date is in the past, send me a message.
I’m sure it’s the preposterous condition I added in there for the input date but I’m not sure how to set it correctly.
tom_l
February 11, 2022, 10:59pm
2
The time condition only looks at the time in your helper. See the puke yellow warning box here: https://www.home-assistant.io/docs/scripts/conditions/#time-condition
You will probably need a template condition.
condition:
- condition: template
value_template: "{{ {{ now().timestamp() > state_attr('input_datetime.last_2nd_floor_filter_change', 'timestamp')|float(0) }} }}"
Hello,
That makes sense and yes that puke yellow warning was right there. Great to know going forward.
I reviewed the solution and it makes sense but It’s throwing an error and I can’t tell why. I reviewed this a dozen times and it looks right to me:
Do you know what’s causing it to throw the template error?
I really appreciate the template help, I still struggle with it a lot.
tom_l
February 11, 2022, 11:50pm
4
Ugh. Copy paste error on my part. Sorry. Template should be:
value_template: "{{ now().timestamp() > state_attr('input_datetime.last_2nd_floor_filter_change', 'timestamp')|float(0) }}"
Too many braces. When I copied the test from my template editor I pasted a template inside a template.
1 Like