-
-
Notifications
You must be signed in to change notification settings - Fork 20
Tips & Tricks: Use Calendar Events to Set Chore Due Dates
These automations are NOT part of the KidsChores Integration but are designed to work with it to dynamically set chore due dates based on events in your calendar. This is a custom approach that allows chore schedules to be updated automatically by simply modifying calendar events, without needing to edit the individual chores.
This method should work with any calendar that has been integrated into Home Assistant. There could be slight naming differences in the data returned, so be aware that small adjustments may be required.
- β Flexible Scheduling: Chore due dates adjust dynamically without going into Home Assistant or KidsChores.
- β Easy Updates: Simply update the calendar entry to change the due date.
- β Recurring Events: Leverage recurring events to automate repeating chores.
This automation looks at upcoming events on your calendar and if it finds the event specified, it will take action to update the due date of the chore you identified.
- Trigger: No trigger is defined in the example, so you can add that when you create the automation (e.g., daily, weekly).
-
Lookup: Searches the next 21 days for the first event matching the
calendar_event_name
that you specified. - Action: Sets the due date for the chore you specified in chore_name using the kidschores.set_chore_due_date service.
alias: "Set Garbage Night From Calendar"
description: ""
triggers: [] # Define your own trigger, such as running daily or weekly
conditions: []
actions:
- target:
entity_id: calendar.parent_name # CHANGE: Set to your calendar entity
data:
start_date_time: "{{ now().isoformat() }}"
end_date_time: "{{ (now() + timedelta(days=21)).isoformat() }}" # CHANGE: Adjust lookahead period if needed
response_variable: calendar_events
action: calendar.get_events
alias: Set target calendar and date range for lookup
- variables:
calendar_event_name: "Garbage Night" # CHANGE: Set this to the event name you're looking for
next_event_start_timestamp: >-
{% set ns = namespace(event=None) %}
{% for key, value in calendar_events.items() %}
{% for event in value.events %}
{% if calendar_event_name in event.summary %}
{% set ns.event = event %}
{% break %}
{% endif %}
{% endfor %}
{% endfor %}
{% if ns.event.start is defined and ns.event.start not in [none, 'unknown', 'unavailable'] %}
{{ ns.event.start | as_datetime | as_timestamp }}
{% else %}
{{ none }}
{% endif %}
alias: Define calendar_event_entry and search returned calendar entries
- action: logbook.log
metadata: {}
data:
name: ""
entity_id: "{{ this.entity_id }}"
message: >-
{% if next_event_start_timestamp not in [none, 'unknown', 'unavailable'] %}
{{ " ** Start Time - " ~ next_event_start_timestamp | timestamp_custom('%Y-%m-%d %H:%M:%S', true) ~ " ** " }}
{% else %}
{{ " ** Event not found ** " }}
{% endif %}
alias: Log results of lookup
- if:
- condition: template
value_template: "{{ next_event_start_timestamp not in [none, 'unknown', 'unavailable'] }}"
then:
- action: kidschores.set_chore_due_date
metadata: {}
data:
chore_name: "Garbage Night" # CHANGE: Set the chore name for KidsChores
due_date: >-
{{ next_event_start_timestamp | timestamp_custom('%Y-%m-%dT%H:%M:%S.000Z', true) }}
mode: single
To customize this for your setup, update the following values:
-
Calendar Entity:
- Change
calendar.parent_name
to your calendar entity name in Home Assistant. - Example:
calendar.household_chores
- Should work with any Home Assistant Integrated calendar.
- Change
-
Calendar Event Name:
- Update
calendar_event_name: "Garbage Night"
to match the exact title of your calendar entry. β οΈ Make the event name unique!- Example: β "Garbage" (might match unrelated events like βTake Out Garbageβ)
- Example: β "Garbage Night Chore" (ensures only the right event is found)
- Update
-
Look-Ahead Period:
- Currently, it searches 21 days ahead (
timedelta(days=21)
). - Adjust this to fit your needs (e.g., 7 days for weekly tasks, 30 days for monthly tasks).
- Currently, it searches 21 days ahead (
-
Trigger Timing:
-
No trigger is defined in the example. You must set when it runs:
- β
Daily at midnight:
triggers: - trigger: time at: "00:00:00"
- β
Weekly on Sundays:
triggers: - trigger: time at: "07:00:00" - trigger: time_pattern weekday: "sun"
- β
Daily at midnight:
-
No trigger is defined in the example. You must set when it runs:
-
Chore Name for KidsChores:
- Change
chore_name: "Garbage Night"
to match your chore name setup in KidsChores.
- Change
To set up this automation in Home Assistant, follow these steps:
- Go to Home Assistant β Settings β Automations & Scenes β Automations.
- Click Create Automation β Select Edit in YAML.
- Delete any pre-filled YAML and paste in the automation provided above.
-
Modify the required values:
- Change the calendar entity (
calendar.parent_name
) to match your Home Assistant calendar. - Update the calendar event name (
Garbage Night
) to match your calendar entry - Update the **chore_name" to match the name of the chore setup in KidsChores
- Change the calendar entity (
- Define a trigger if needed (e.g., run the automation daily at midnight).
- Click Save and enable the automation.
-
Test by adding a chore event to the calendar and ensuring it updates
input_datetime
.
This automation includes an action to log when it runs, whether it found the chore event, and the start time of the event (if found).
π‘ Getting Started
π§Ή System Overviews & Examples
- Access Control Overview & Best Practices
- Chore Status & Recurrence
- Shared Chores
- Badges
- Bonuses & Penalties
- Challenges & Achievements
- Sensors & Buttons
π‘ Tips & Tricks
- Dashboard Auto Populating UI
- Automatic Approval of Chores
- Penalty for Overdue Chore
- Critical Overdue Alerts
- Show Pending Approvals
- Use Calendar to set Due Date
- Use NFC Tag to Claim Chore
βοΈ Services & Automation
π¨ Troubleshooting