Skip to content

Automations

tempus2016 edited this page Jun 17, 2026 · 6 revisions

Examples of useful automations using TaskMate sensors and services.


Internal Scheduled Tasks

TaskMate runs several automatic tasks on a schedule. These are not HA automations — they run inside the integration.

Midnight tasks (00:00:05)

Task Description
Streak check Updates each child's streak. In reset mode: missed days reset the streak to 0. In pause mode: missed days freeze the streak until the next completion.
One-shot chore expiry Disables any one-shot chores created on the previous day.
Assignment rotation Recomputes assignment_current_child_id for chores using alternating, random, or balanced modes. Task group policies (sticky/spread) are applied after raw picks.
Calendar publishing Publishes chore assignment events to configured HA calendar entities, projected ahead by the configured number of days. Uses configurable time-of-day boundaries (v3.6.0+).
Perfect week check Runs on Mondays only. Awards the perfect week bonus to any child who completed at least one chore every day the previous week (Mon–Sun).
Stale timed session cleanup Stops any timed task sessions left running from previous days. Creates completion records with elapsed time up to midnight.
Career score snapshot Saves each child's career score for historical tracking. Prunes snapshots older than 90 days.
Skip state reset Clears ephemeral skip data (skip_date, skip_count) from the previous day.

History pruning (00:01:00)

Trims old completion records to the configured History Days setting (default: 90 days, range: 30–365).

Availability monitoring (real-time)

TaskMate listens for state_changed events on all entities configured as a child's Availability Entity. When a tracked entity changes state:

  1. TaskMate re-evaluates which children are available
  2. Chores with Require Availability enabled recompute their assignments
  3. Unavailable children are skipped in alternating, random, and balanced rotation

Recognised "available" states: on, home, available, present, true. Any other state (including unavailable, off, unknown) is treated as unavailable.

Assignment rotation algorithms

Mode Algorithm
alternating Round-robin using (today - anchor_date) mod pool_size to pick the child index
random Deterministic daily pick using SHA256(chore_id + date) — stable within a day, changes at midnight
balanced Groups all balanced-mode chores sharing the same child pool, sorts by ID, and distributes evenly via round-robin so no child gets more than one extra chore

Task group assignment

After raw per-chore rotation picks are calculated:

  1. Sticky groups: The first chore (leader) keeps its pick. All followers are forced onto the leader's child, provided that child is in their pool. If not, followers fall back to their own pick.
  2. Spread groups: Each chore is assigned a different child. The algorithm walks forward from each chore's raw pick to find an unused child, wrapping if more chores than children.

Calendar event format

When chores are published to a calendar, the events look like this:

  • Title: Wash Dishes — Tommy (chore name + assigned child)
  • Time-based chores create timed events matching the time category:
Time category Event window
morning 06:00–12:00
afternoon 12:00–17:00
evening 17:00–21:00
night 21:00–23:59
anytime All-day event
  • Description contains an internal marker (taskmate:chore:<id>) used for cleanup — do not edit it manually
  • Events are only published for dates not already in the calendar (idempotent)
  • When a chore is deleted or edited, old calendar events are automatically cleaned up

Automatic reward expiry & refunds

At midnight, rewards past their expiration date are marked expired. Pool allocations for expired rewards are automatically refunded to each child's spendable balance. The same refund logic runs when a reward's cost is reduced below a child's current allocation.

Timed task auto-stop

Stale timed sessions (sessions from a previous day still in running or paused state) are automatically stopped at midnight. A completion record is created using the elapsed time accumulated up to that point. This prevents children from accidentally leaving timers running overnight.


Bus Events Reference

TaskMate fires Home Assistant bus events for most state changes. Trigger your own automations off them with an event trigger. Every event carries a timestamp (ISO 8601) unless noted, and most carry child_id / child_name.

Points, rewards & penalties

Event Data fields
taskmate_penalty_applied child_id, child_name, penalty_id, penalty_name, points, timestamp
taskmate_bonus_applied child_id, child_name, bonus_id, bonus_name, points, timestamp
taskmate_points_gifted from_child_id, from_child_name, to_child_id, to_child_name, points, timestamp
taskmate_points_decay child_id, child_name, points, timestamp
taskmate_interest_paid child_id, child_name, points, timestamp
taskmate_surprise_bonus child_id, child_name, points, timestamp
taskmate_perfect_week child_id, week_key, bonus, timestamp

Chores

Event Data fields
taskmate_chore_completed child_id, child_name, chore_id, chore_name, points, difficulty, timestamp
taskmate_chore_approved child_id, chore_id, completion_id, timestamp
taskmate_chore_rejected child_id, child_name, chore_id, chore_name, completion_id, timestamp
taskmate_swap_approved chore_id, requester_id, from_child_id, timestamp

Rewards

Event Data fields
taskmate_reward_claimed child_id, reward_id, claim_id, cost, timestamp
taskmate_reward_approved child_id, child_name, reward_id, reward_name, cost, timestamp
taskmate_reward_rejected child_id, child_name, reward_id, reward_name, timestamp

Streaks, badges & gamification

Event Data fields
taskmate_streak_updated child_id, current_streak, best_streak, timestamp
taskmate_badge_earned child_id, badge_id, awarded_id, name, icon, tier
taskmate_level_up child_id, child_name, level, timestamp
taskmate_celebration child_id, child_name, kind, tier (1–3), message, timestamp (+ event-specific extras, e.g. level)
taskmate_quest_completed child_id, child_name, quest_id, quest_name, bonus, timestamp
taskmate_challenge_completed child_id, child_name, challenge_id, challenge_name, scope, bonus, timestamp

Notification-type events (taskmate_pending_chore_approval, taskmate_badge_earned, taskmate_weekly_digest, …) carry an extra recipients list and are documented in Notifications.

Example — react to a celebration with lights

The taskmate_celebration event carries a tier (1 = small, 2 = medium, 3 = epic) so a single automation can scale its reaction to the size of the moment.

alias: TaskMate — Celebrate big moments
triggers:
  - trigger: event
    event_type: taskmate_celebration
conditions:
  - condition: template
    value_template: "{{ trigger.event.data.tier >= 3 }}"
actions:
  - action: light.turn_on
    target:
      entity_id: light.living_room
    data:
      effect: rainbow
  - action: notify.mobile_app_johns_phone
    data:
      title: "🎉 TaskMate"
      message: "{{ trigger.event.data.message }}"

Example — log every penalty

alias: TaskMate — Log penalties
triggers:
  - trigger: event
    event_type: taskmate_penalty_applied
actions:
  - action: logbook.log
    data:
      name: TaskMate
      message: >
        {{ trigger.event.data.child_name }} lost
        {{ trigger.event.data.points }} for "{{ trigger.event.data.penalty_name }}"

Example Automations


Notify Parents When Approvals Are Pending

Note: TaskMate v1.1.3+ has built-in notification support. Configure a notify service in Settings → Integrations → TaskMate → Configure → Settings → Notification Service for simple per-chore alerts. Use the automation below for more control — multiple recipients, conditions, custom messages, scheduling.

Send a push notification to the parent's phone when a chore is waiting for approval.

alias: TaskMate — Notify on pending approval
trigger:
  - platform: state
    entity_id: binary_sensor.taskmate_has_pending_approvals
    to: "on"
action:
  - service: notify.mobile_app_johns_phone
    data:
      title: "TaskMate ✅"
      message: >
        {{ state_attr('binary_sensor.taskmate_has_pending_approvals', 'pending_chore_completions') }}
        chore(s) and
        {{ state_attr('binary_sensor.taskmate_has_pending_approvals', 'pending_reward_claims') }}
        reward claim(s) awaiting approval.
      data:
        url: /lovelace/parent-dashboard

Remind Child to Complete Chores

Send a reminder if a child hasn't completed any chores by a certain time.

alias: TaskMate — Evening chore reminder
trigger:
  - platform: time
    at: "18:00:00"
condition:
  - condition: template
    value_template: >
      {% set children = state_attr('sensor.taskmate_overview', 'children') %}
      {% set child = children | selectattr('name', 'eq', 'Malia') | first %}
      {{ child.pending_points == 0 and child.points == child.points }}
      {# Simpler: check if done_today from todays_completions #}
action:
  - service: notify.mobile_app_malias_tablet
    data:
      title: "Don't forget your chores! 🌟"
      message: "You still have chores to do today. Check your chore list!"

Award Bonus Points for Good Behaviour

Use an input_button or a script to quickly award bonus points.

# input_button.yaml
input_button:
  malia_bonus:
    name: "Award Malia Bonus Points"
    icon: mdi:star-plus
 
# automation.yaml
alias: TaskMate — Award bonus on button press
trigger:
  - platform: state
    entity_id: input_button.malia_bonus
action:
  - service: taskmate.add_points
    data:
      child_id: a8c8376a
      points: 5
      reason: "Good behaviour bonus"

Weekly Summary Notification

Send a weekly summary of each child's activity every Sunday evening.

alias: TaskMate — Weekly summary
trigger:
  - platform: time
    at: "19:00:00"
condition:
  - condition: time
    weekday:
      - sun
action:
  - service: notify.mobile_app_johns_phone
    data:
      title: "TaskMate Weekly Summary 📊"
      message: >
        {% set children = state_attr('sensor.taskmate_overview', 'children') %}
        {% for child in children %}
        {{ child.name }}: {{ child.points }} pts | {{ child.current_streak }} day streak
        {% endfor %}

Complete a Chore via NFC Tag

Tap an NFC tag to automatically complete a chore without opening the app.

alias: TaskMate — NFC complete Make Bed
trigger:
  - platform: tag
    tag_id: "your-nfc-tag-id-here"
action:
  - service: taskmate.complete_chore
    data:
      chore_id: b3f9a12c
      child_id: a8c8376a
  - service: notify.mobile_app_malias_tablet
    data:
      title: "Chore completed! ⭐"
      message: "Make Bed marked as done. +5 Stars!"

Complete a Chore When a Smart Device is Used

Use a smart plug or presence sensor to automatically complete a chore.

Example: Brushing teeth — complete when bathroom motion detected at the right time:

alias: TaskMate — Auto complete brush teeth
trigger:
  - platform: state
    entity_id: binary_sensor.bathroom_motion
    to: "on"
condition:
  - condition: time
    after: "07:00:00"
    before: "08:30:00"
  - condition: time
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
action:
  - service: taskmate.complete_chore
    data:
      chore_id: brush_teeth_chore_id
      child_id: a8c8376a

Daily Streak Reminder

Remind a child if they haven't completed a chore today and their streak is at risk.

alias: TaskMate — Streak risk reminder
trigger:
  - platform: time
    at: "20:00:00"
condition:
  - condition: template
    value_template: >
      {% set children = state_attr('sensor.taskmate_overview', 'children') %}
      {% set child = children | selectattr('name', 'eq', 'Malia') | first %}
      {% set today_completions = state_attr('sensor.taskmate_overview', 'todays_completions') | selectattr('child_id', 'eq', child.id) | list %}
      {{ today_completions | length == 0 and child.current_streak > 0 }}
action:
  - service: notify.mobile_app_malias_tablet
    data:
      title: "🔥 Your streak is at risk!"
      message: >
        {% set children = state_attr('sensor.taskmate_overview', 'children') %}
        {% set child = children | selectattr('name', 'eq', 'Malia') | first %}
        You have a {{ child.current_streak }} day streak! Complete a chore before midnight to keep it going.

Display Pending Approvals on a Dashboard Badge

Show a badge on your parent dashboard that turns red when approvals are pending.

# In your dashboard YAML
- type: entity
  entity: sensor.pending_approvals
  name: Pending
  icon: mdi:clipboard-clock
  state_color: true

Or use a conditional card to show a banner:

- type: conditional
  conditions:
    - entity: binary_sensor.taskmate_has_pending_approvals
      state: "on"
  card:
    type: markdown
    content: >
      ## ⚠️ {{ states('sensor.pending_approvals') }} item(s) need your attention
    card_mod:
      style: |
        ha-card {
          background: var(--warning-color);
          color: white;
        }

Auto-Approve Chores After a Timeout

Automatically approve all pending completions if the parent hasn't approved after 24 hours.

alias: TaskMate — Auto approve after 24h
trigger:
  - platform: time_pattern
    hours: "/1"
condition:
  - condition: template
    value_template: >
      {{ state_attr('sensor.pending_approvals', 'chore_completions') | length > 0 }}
action:
  - repeat:
      for_each: >
        {{ state_attr('sensor.pending_approvals', 'chore_completions') |
           selectattr('completed_at', 'lt', (now() - timedelta(hours=24)).isoformat()) |
           list }}
      sequence:
        - service: taskmate.approve_chore
          data:
            completion_id: "{{ repeat.item.completion_id }}"

Jinja2 Template Examples

Useful templates for dashboard cards and automations.

Get a specific child's points:

{% set children = state_attr('sensor.taskmate_overview', 'children') %}
{% set child = children | selectattr('name', 'eq', 'Malia') | first %}
{{ child.name }} has {{ child.points }} {{ state_attr('sensor.taskmate_overview', 'points_name') }}

List all children and their streaks:

{% set children = state_attr('sensor.taskmate_overview', 'children') %}
{% for child in children %}
  {{ child.name }}: {{ child.current_streak }} day streak
{% endfor %}

Check if any child has a pending claim:

{{ state_attr('binary_sensor.taskmate_has_pending_approvals', 'pending_reward_claims') > 0 }}

Get today's completions for a specific child:

{% set completions = state_attr('sensor.taskmate_overview', 'todays_completions') %}
{% set child_completions = completions | selectattr('child_id', 'eq', 'a8c8376a') | list %}
{{ child_completions | length }} chores done today

Clone this wiki locally