Script For Recurring Chores in Home Assistant

This script creates tasks for your chores and sends notifications.

Flo

The function of the script

This script helps you manage recurring household chores in Home Assistant by automatically creating tasks with due dates and sending reminders when tasks are due or overdue.

I have used Perplexity AI for this to work (it took way too many iterations) so please write to me if some of the code originates from somewhere else and I missed a source.

The code of the script

Daily Chore Manager Script
alias: Daily Chore Manager
description: Manage recurring chores with status checks and reminders
mode: queued
sequence:
- alias: Set chore variables
variables:
chores:
- name: Pflanzen Gang gießen
interval: 14
- name: Bettwäsche wechseln
interval: 14
- name: Backofen reinigen
interval: 30
- alias: Fetch all tasks once
target:
entity_id: todo.haushalt
response_variable: service_response
action: todo.get_items
data:
status: needs_action
- alias: Process each chore
repeat:
for_each: "{{ chores }}"
sequence:
- alias: Check task existence and details
variables:
all_tasks: "{{ service_response['todo.haushalt']['items'] | default([]) }}"
task_summaries: "{{ all_tasks | map(attribute='summary') | list }}"
item_exists: "{{ repeat.item.name in task_summaries }}"
existing_task: >-
{{ all_tasks | selectattr('summary', '==', repeat.item.name) |
list | first | default({}) }}
- alias: Create new task if needed
if:
- condition: template
value_template: "{{ not item_exists }}"
then:
- target:
entity_id: todo.haushalt
data:
item: "{{ repeat.item.name }}"
due_date: >
{{ (now() +
timedelta(days=repeat.item.interval)).strftime('%Y-%m-%d') }}
action: todo.add_item
- alias: Send due today reminder
if:
- condition: template
value_template: >
{{ existing_task.due is defined and
existing_task.due.split('T')[0] == now().strftime('%Y-%m-%d') }}
then:
- data:
message: "⏰ Erinnerung: {{ repeat.item.name }} heute fällig!"
action: notify.notify
- alias: Process overdue tasks
variables:
today: "{{ now().strftime('%Y-%m-%d') }}"
all_tasks: "{{ service_response['todo.haushalt']['items'] | default([]) }}"
overdue_tasks: >
{{ all_tasks |
selectattr('due', 'defined') |
selectattr('due', 'string') |
selectattr('due', 'lt', today + 'T00:00:00') |
rejectattr('due', 'contains', today) |
map(attribute='summary') |
list }}
- alias: Send overdue tasks notification
if:
- condition: template
value_template: "{{ overdue_tasks | length > 0 }}"
then:
- service: notify.notify
data:
title: "⚠️ {{ overdue_tasks | length }} überfällige Aufgaben"
message: >
{% for task in overdue_tasks -%}
• {{ task }}{{ '\n' }}
{%- endfor %}

The necessary automation

To use this script effectively, you’ll need to create an automation that runs it daily:

Daily Chore Manager Automation
alias: Run Daily Chore Manager
description: Runs the chore manager script once per day
trigger:
- platform: time
at: "08:00:00"
action:
- service: script.daily_chore_manager