In this guide, I’ll show you how to create recurring tasks in Home Assistant. For example, if you are looking to keep track of things such as:
- HVAC filter reminders
- Salt reminders for water softener
- Pill Reminder
- Oil Changes
- Yearly reminders such as cleaning the gutters, vehicle inspection/renewals
- Dental/Doctor visit reminders
…then this is the guide for you.
And once the task is created, I’ll show you how to create sensors that displays “Days Until A Task is Due” or “Days Since a task has been completed”
For this tutorial, I am creating a 90-day water filter replacement recurring task. No additional addons or integrations are needed for this, just some good ol’ template sensors and helpers.
The exact same procedure can be used for any recurring task, just be sure to change the entity names and dates.
Let’s get started!
Similar Guides
I have a number of other really useful guides regarding tasks/chores, so I’m linking those below for you.
- Follow my Chore Tracker in Home Assistant guide if you want to create a point-based rewards system when your child completes a chore or task.
- Follow my “Days Until” guide if you’re interested in creating a countdown Lovelace card (for anniversaries, holidays, etc)
- Follow my Home Assistant Birthday Reminder Card guide if you’d like to keep track of your family’s birthdays and display them on a Lovelace card.
- Follow my Garbage Reminder card tutorial to be reminded of trash & recycling day.
How It Works
As you can see in the screenshot below, the “number of days until something is due” can be changed from Lovelace, as well as the “last replaced date”.
For example, if you change your HVAC air filter every 90 days, change the Water Filter Threshold to 90. If you take medicine once a week, set it to 7.
Once the task is complete, just click the Tap To Complete Task button to reset the date to today.


Step 1: Create 2 Helpers
The first thing we need to do is create 2 Helpers: 1 Number helper, and 1 Date and/or Time helper.
- The “number helper” will be used to set the number of days until something should be completed/is due.
- The “datetime helper’ will be used to set the last completed date.
Helpers can be founds in the Configuration > Automations & Scenes > Helpers tab. Click Add Helpers.

Helper #1: Toggle
Add Helper > Number.
- Name: Water Filter Threshold
- Icon:
mdi:water-circle
- Step size: 1
Then click Create.

Helper #2: Datetime helper
Add helper > Date and/or time.
- Name: Water Filter Last Replaced
- Choose “Date” radial
Then click Create.

After creating those two helpers, search the Helpers tab for water to find your entity ID names. If you followed my naming convention, then yours will be the exact same as mine below. If not, document yours, you’ll need to copy and paste these into the next step.
input_datetime.water_filter_last_replaced
input_number.water_filter_threshold

Add Sensors to Configuration.yaml
Next, we need to create a few template sensors by adding the below code to your configuration.yaml file.
These sensors will let you add a “Days Since Water Filter Was Replaced” or “Days Until Water Filter Needs Replacing” sensor to a Lovelace card.
File Editor > Configuration.yaml.
If you don’t have a sensors:
block added to your config file yet, then paste this code:
sensor:
- platform: template
sensors:
water_filter_days_remaining:
friendly_name: 'Water Filter Days remaining'
value_template: >
{{ states('input_number.water_filter_threshold') | int - (now() -
states( 'input_datetime.water_filter_last_replaced')
| as_datetime | as_local ).days }}
icon_template: mdi:clock-end
unit_of_measurement: 'Days'
- platform: template
sensors:
water_filter_days_since_replacement:
friendly_name: 'Water Filter Days Since Replaced'
value_template: >
{{ ((as_timestamp(now()) - state_attr('input_datetime.water_filter_last_replaced','timestamp')) | int / 86400) | round(0) -1 }}
icon_template: mdi:clock-end
unit_of_measurement: 'Days'
If you do have a sensors:
section, then just paste this onto a new line below the last entry.
- platform: template
sensors:
water_filter_days_remaining:
friendly_name: 'Water Filter Days remaining'
value_template: >
{{ states('input_number.water_filter_threshold') | int - (now() -
states( 'input_datetime.water_filter_last_replaced')
| as_datetime | as_local ).days }}
icon_template: mdi:clock-end
unit_of_measurement: 'Days'
- platform: template
sensors:
water_filter_days_since_replacement:
friendly_name: 'Water Filter Days Since Replaced'
value_template: >
{{ ((as_timestamp(now()) - state_attr('input_datetime.water_filter_last_replaced','timestamp')) | int / 86400) | round(0) -1 }}
icon_template: mdi:clock-end
unit_of_measurement: 'Days'
If you used custom entity names, make sure to swap yours in.
Reload Template Entities (or reboot HA)
Next, we need to make these template sensors active. You can either restart Home Assistant (Configuration > Settings > Check Configuration > Restart) or reload the Template Entities section (Configuration > Settings > Template Entities):

Add Entities to Entities Card
On any of your Lovelace dashboards, click Add Card. Choose Entities card.
Add all of the newly created entities (tip: just search water). There should be 4 of them.
As you can see in the screenshot below, the current date is 4/11/2022. I’ve set the “water filter last replaced” date to 4/1/2022, which was 10 days ago. The Days Since Replaced sensor accurately shows 10.
For the threshold, I set it to 10 days (reminder: water_filter_threshold is the # of days until something is due) Since it was 10 days since I last replaced it, the days remaining is now 0, which means it needs to be replaced today.

Create Script to Reset “Last Replaced” Date to Today
The next step is to create a simple script that resets the date to today. (You could of course just manually set it from the datetime helper, too).
A script is just an automation without a trigger, which makes them great for task-tracking.
I prefer to use a script for this because I have Ikea smart buttons placed near the areas HVAC unit when I replace the air filter, and another near the kitchen sink when I replace the sink filter. I can just click the button once the recurring task is complete. Or, you can call a script from an automation or by adding it to Google Assistant for voice control.
Configuration > Automations & Scenes > Scripts tab.
Click Add Script.
Click the 3 dots in the top-right corner to edit in YAML. Then paste this in.
alias: Reset Water Filter Date to Today
sequence:
- service: input_datetime.set_datetime
data_template:
date: '{{ now().strftime(''%Y-%m-%d'') }}'
target:
entity_id: input_datetime.water_filter_last_replaced
mode: single
Before you run the script, set the date back a few days using the Datetime helper.
Then save and test the script by clicking the RUN SCRIPT button. If it works from here, the next step is to create a Lovelace button that calls this script to run.
Your new script entity is this: script.reset_water_filter_date_to_today
Create Button to Run Script
On a Lovelace dashboard, click Add Card > Button.
For the Entity, search for your script entity and leave the tap action to Toggle.
Now once your recurring task is complete, you can just tap that button!

And once you’ve done customizing, here’s what it’ll end up looking like.

Wrapping Up
Now that you’ve got everything working comes the fun part: customizing a new tasks reminder dashboard. You could also create a Google Home routine to verbally mark the task as complete (which is as simple as exposing the script entity to Google Assistant and creating a simple routine – follow the “Setup Roborock with Google Assistant” section of my guide here)
I recently moved all of my views and dashboards to Mushroom Card, so if you were looking to create a dashboard like what mine looks like, I have a Home Assistant Mushroom Card guide as well.
I’m still tweaking my new Tasks view and adding chores, so I’ll probably update some screenshots and YAML once I do.
If you followed this guide to create your own recurring chore reminder cards, I’d love to see how you laid your tasks out in Lovelace, so please share!
My Favorite Home Assistant Devices
Below are some of the Home Assistant-compatible devices I personally use in my home. I highly recommend each of them.
- Zwave/Zigbee hub: Nortek GoControl HUSBZB-1
- Smart Plugs: Sonoff S31 Lite Zigbee
- Motion Sensors: Hue Indoor Motion
- Outdoor Camera: Amcrest IP5M Turret
- Robot Vacuum: Roborock S7
The full list of all Home Assistant compatible & recommended devices I use can be found on my Equipment List page.
Love your stuff Danny, thanks for sharing!
Glad I could help!
Thank you for your great guide! I really like the look of the mushroom tasks.
Can you show how you created the top mushroom card with the last time the filters were replaced, and how you created the button?
I’m redesigning my tasks dashboard, and unfortunately I deleted that card and YAML. But I think the top mushroom card was a basic Mushroom Entity Card and with my input_datetime.water_filter_last_replaced entity in it.
For the button, I just added a standard Button card. Under tap action, choose call service and have it call the script.reset_water_filter_date_to_today. In the button options, uncheck “icon” and give it a custom title like ‘Tap to Complete Task1’. Under theme, I chose a theme I downloaded from HACS which turned the button purple, I think it might’ve been the synthwave theme.
Thank you!
How do you manage tasks that falls across the change of the year or that has a period of one year from one due date to the other?
The template for calculating the remaining days does not produce the correct number. Can you suggest me a modification in the template to take in account the change of year ?
I’m not sure I understand. Are you meaning if you have a task in December and want to calculate days remaining in Jan of the next year? If you can give me me an example task with two dates, I’ll see if I can figure out the template for it
Hey Danny, really nice work 🙂
I am new to HA and running a container version. How do I add templates ? I tried adding to my confguration.yaml but got errors :/
Do I need any new integration ?
Thanks a lot once again 🙂
Hi Danny,
I am stuck on cusotmizing the lovelace and I keep getting error”Custom element doesn’t exist: stack-in-card.
type: custom:stack-in-card
cards:”
I already have mushroom cards and installed and I had some of them setup already. Could you please review how did you accomplish the mushroom card for this task?
I don’t believe I needed to use custom:stack-in-card for this.
I think the top mushroom card was a basic Mushroom Entity Card and with my input_datetime.water_filter_last_replaced entity in it.
For the button, I just added a standard Button card. Under tap action, choose call service and have it call the script.reset_water_filter_date_to_today. In the button options, uncheck “icon” and give it a custom title like ‘Tap to Complete Task1’. Under theme, I chose a theme I downloaded from HACS which turned the button purple, I think it might’ve been the synthwave theme.
Thank you Danny again for the card info. I finally got it done. One more question regarding the sensors mentioned here. Is there a way to recreate them using the modern configuration instead of the legacy sensors? Thank you again.
Not that I know of, just because you have to use custom template info to get the correct data.
Thanks for this!
I followed your example and only two sensors (not 4). I did add this to my sensors.yaml instead of configuration.yaml. Would that make a difference & if so, why?
Thanks again!
You’re welcome! Nope, it shouldn’t make a difference as long as you’ve added the !include for your sensors.yaml in your configuration.yaml
Only 2 sensors should show up, so if that’s all you see you should be good. The other two in my guide are helpers and can be found on the entities page.
Thanks for the quick response! Any ideas as to why I’d only see two ENTITIES (mistakenly said Sensors in my last post)?
Cool idea, I found it to be really useful. I tried using this in an automation, specefically the days remaining sensor so that it would send a notification at < 10 days but but the automation keeps failing when i test it. I assume it's because my template is wrong. Am I over thinking this? If not and you get a chance, can you help with a template that will trigger the automation <= X days.
Thanks, keep up the cool stuff.
All works fine with your Code in my HA, but one question, which routine is running in the background to change each day the sensors values?