Recurring Task Template Entities
Referring page: Recurring Task Tracking
This page provides code examples for the data objects that need to be created to support my recurring task tracking feature.
Entity Creation
Tasks and Task_actions are created in pairs (more information on how I’ve decided to use them is [here](ADD LINK)). As shown below, a Task is setup in Home Assistant as a trigger based binary sensor with a variety of attributes. A Task_action is setup simply as an input boolean.
NOTE: The yaml config below is dependent the existence of a Jinja based custom template. That code is available here.
Task Entity (creates binary_sensor.chore_change_keurig_filter
):
template:
- trigger:
- platform: time
at: '06:30:00'
- platform: state
entity_id: input_boolean.status_change_keurig_filter
from: 'off'
binary_sensor:
- name: "Chore change keurig filter"
unique_id: chore_change_keurig_filter
state: |
{% set e_string = 'change_keurig_filter' %}
{% from 'tasks.jinja' import determine_task_state %}
{{ determine_task_state(e_string) }}
attributes:
last_updated: "{{ now() | as_local }}"
last_triggered: |
{% set e_string = 'change_keurig_filter' %}
{% from 'tasks.jinja' import get_last_triggered %}
{{ get_last_triggered(e_string) }}
last_completed: |
{% set e_string = 'change_keurig_filter' %}
{% from 'tasks.jinja' import get_last_completed %}
{{ get_last_completed(e_string) }}
trigger_type: "time"
trigger_interval: "Every 2 months on the 1st Sunday"
next_trigger: |
{% set e_string = 'change_keurig_filter' %}
{% from 'tasks.jinja' import get_next_trigger %}
{{ get_next_trigger(e_string) }}
overdue: |
{% set e_string = 'change_keurig_filter' %}
{% from 'tasks.jinja' import check_if_overdue %}
{{ check_if_overdue(e_string) }}
Task_action Entity (creates input_boolean.status_change_keurig_filter
):
input_boolean:
status_change_keurig_filter:
name: "Status Change Keurig Filter"