惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
DataBreaches.Net
N
Netflix TechBlog - Medium
P
Proofpoint News Feed
D
Docker
J
Java Code Geeks
L
LangChain Blog
Microsoft Security Blog
Microsoft Security Blog
The GitHub Blog
The GitHub Blog
I
InfoQ
Stack Overflow Blog
Stack Overflow Blog
云风的 BLOG
云风的 BLOG
Engineering at Meta
Engineering at Meta
MongoDB | Blog
MongoDB | Blog
月光博客
月光博客
T
Tailwind CSS Blog
M
MIT News - Artificial intelligence
Blog — PlanetScale
Blog — PlanetScale
Google DeepMind News
Google DeepMind News
腾讯CDC
罗磊的独立博客
U
Unit 42
爱范儿
爱范儿
Vercel News
Vercel News
MyScale Blog
MyScale Blog

herrkaefer

"Vibe planning \u003e vibe coding" "Anything to Markdown" "Built anocus: anonymous commenting for static sites" "日记与小说 -- AI 续写小说欣赏" "Any-podcast: from newsletters to a podcast" "Made MicPipe: a simple voice input tool using ChatGPT dictation" "关于 Tools 和 Skills 的一点感想" "Realtime monitoring of ComEd hourly price" "Introducing SwiftEdgeTTS" "Thoughts on the philosophy of building AI-native apps" "jelly鼻屎" "等饭的人" "Migrated Blog to Hugo and Cloudflare Pages" "Easy Aspen monitoring for Chicago parents" "Introducing HabitBuilder: A simple Telegram bot for habit tracking" "鼓捣" "Open folder or file with Sublime Text from Finder toolbar" "Python dev workflow on macOS" "Create new text file from Finder toolbar" "Uno reinvented for 3-year-old kids" "Uno变身儿童数字游戏" "自动转发Twitter到微博" "Handle annoying operations of objects in Realm DB" "Move Jekyll blog to Ubuntu VPS" "Introducing Mole" "Note taking without note taking app" "Deploy Python web application on Ubuntu server" "Setup Shadowsocks / VPN on Ubuntu Server" "Linode Notes - Basic Setup" "CLASS Style Adapted for Embedded Systems"
"Use home assistant to motivate my kid to brush teeth"
"herrkaefer" · 2025-10-22 · via herrkaefer

I hope you’re not in the same boat, but getting my kids to brush their teeth consistently can be a daily struggle. After an unpleasant incident this morning, I decided to add some fun to the routine using Home Assistant, hoping my daughter would stay motivated (at least for a while😆).

With this setup, I wanted the teeth brushing events to be automatically detected, announced by the Google speaker, accompanied by a two-minute song playing, and recorded in Home Assistant.

Plan

As she is using a plain electric tooth brush without bluetooth or app connection, there’s no direct way to get the teeth brushing data. I was thinking to put a NFC stick on the brush or somewhere, but it doesn’t sound good because it relies on a phone touch to trigger.

So I removed a Zigbee button from the frontdoor (which was set to press before leaving home but rearly used) and stick it on the mirror in the bathroom. The kid can press it to start the brushing automation.

Here’s a random link of the button on AliExpress.

Components that are needed for this flow:

  • A working Home Assistant
  • A Aqara Zigbee Button
  • Google Speaker (or any speaker that can be controled by home assistant) for voice & music
  • Spotify and Spotcast integrations for 2-minute brushing songs

Helpers

Create a few helper entities in Home Assistant:

  • input_datetime.teeth_brushing_start and end (single brushing recording)
  • counter.teeth_brushing_counter (daily count)
  • counter.teeth_brush_streak (streak days)

Automations

1. Brushing Routine

The kid is expected to press the button and then start the brushing. The button triggers an automation:

  1. Records brushing start time
  2. Let the speaker announces start
  3. Plays a song from a predefined Spotify playlist for 2 minutes
  4. Announces completion and records the end time
  5. Increments the daily brushing counter
alias: Brush teeth
description: ""
triggers:
  - device_id: 24c653c21ef64657d22831f1194c63e1
    domain: zha
    type: remote_button_short_press
    subtype: remote_button_short_press
    trigger: device
conditions:
  - condition: time
    after: "06:00:00"
    before: "23:59:00"
actions:
  - action: input_datetime.set_datetime
    metadata: {}
    data:
      datetime: "{{now()}}"
    target:
      entity_id: input_datetime.teeth_brushing_start
  - action: media_player.volume_set
    metadata: {}
    data:
      volume_level: "{{ volume_level }}"
    target:
      entity_id: "{{ speaker }}"
  - action: tts.google_translate_say
    metadata: {}
    data:
      cache: true
      entity_id: "{{ speaker }}"
      message: Let's brush our teeth for two minutes!
  - delay: "00:00:05"
  - action: script.play_spotify_list
    metadata: {}
    data:
      entity: "{{ speaker }}"
      uri: "{{ playlist_uri }}"
      volume: "{{ (volume_level * 100) | int }}"
  - delay:
      hours: 0
      minutes: 1
      seconds: 50
      milliseconds: 0
  - action: input_datetime.set_datetime
    metadata: {}
    data:
      datetime: "{{now()}}"
    target:
      entity_id: input_datetime.teeth_brushing_end
  - action: counter.increment
    metadata: {}
    data: {}
    target:
      entity_id: counter.teeth_brushing_counter
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ states('counter.teeth_brushing_counter') | int == 1 }}"
        sequence:
          - data:
              cache: false
              entity_id: "{{ speaker }}"
              message: >
                Great job starting your day with brushing! You’re on a {{
                states('counter.teeth_brushing_streak') | int }}-day streak.
                Keep it up, and you’ll make it even longer tonight!
            action: tts.google_translate_say
      - conditions:
          - condition: template
            value_template: "{{ states('counter.teeth_brushing_counter') | int == 2 }}"
        sequence:
          - target:
              entity_id: counter.teeth_brushing_streak
            action: counter.increment
          - data:
              cache: false
              entity_id: "{{ speaker }}"
              message: >
                Fantastic! You’ve brushed twice today and kept your streak
                going! That’s now {{ states('counter.teeth_brushing_streak') |
                int }} days in a row! Awesome job, keep shining!
            action: tts.google_translate_say
      - conditions:
          - condition: template
            value_template: "{{ states('counter.teeth_brushing_counter') | int > 2 }}"
        sequence:
          - data:
              cache: true
              entity_id: "{{ speaker }}"
              message: >
                Wow, you’re really into brushing today! Keep those teeth
                sparkling clean!
            action: tts.google_translate_say
variables:
  speaker: media_player.mira_room_speaker
  volume_level: |
    {% set now_time = now().strftime('%H:%M') %} {% if now_time < '21:15' %}
      0.47
    {% else %}
      0.12
    {% endif %}
  playlist_uri: spotify:playlist:3lacrdXRalnL5FJrzb4UcS
mode: single

2. Midnight Helpers Update

At midnight, another automation checks whether (>= 2) brushing happened that day, and update the counter and streak.

alias: Update Teeth Brush Helpers at Midnight
description: Reset daily counter and streak
triggers:
  - at: "23:59:00"
    trigger: time
conditions: []
actions:
  - variables:
      brushed_today: "{{ states(daily_counter) | int > 1 }}"
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ not brushed_today }}"
        sequence:
          - target:
              entity_id: "{{ streak_counter }}"
            action: counter.reset
  - target:
      entity_id: "{{ daily_counter }}"
    action: counter.reset
mode: single
variables:
  daily_counter: counter.teeth_brushing_counter
  streak_counter: counter.teeth_brushing_streak

Stream emoji evolution on dashboard!

🥚 → 🐣 → 🐥 → 🐓 → 🦅 → 🐦‍🔥 → 🐉

Make it a bit more fun by adding some emoji evolution on home assistant dashboard. Each emoji evolves every 7 days to another level. This little trick has been working very well for my daughter to keep her motivated. Actually this idea was suggested by my daughter herself, and she always wants to take a look at the dashboard to see how the emojis are evolving after brushing.

A single Mushroom Template Chip shows both today’s brushing and the running streak. The number of 🪥 icons corresponds to the daily brushing count, and the streak is visualized with fire emojis.

type: custom:mushroom-chips-card
chips:
  - type: template
    entity: counter.teeth_brushing_counter
    icon: mdi:toothbrush-electric
    icon_color: blue
    content: >
      {% set count = states('counter.teeth_brushing_counter') | int %} {% set
      streak = states('counter.teeth_brushing_streak') | int %} {% set brushes =
      '🪥' * count if count > 0 else '0' %}

      {% set stage = streak // 7 %} {% set rem = streak % 7 %}

      {% set evolutions = ['🐣', '🐥', '🐓', '🦅', '🐦‍🔥'] %}

      {% if stage == 0 %}
        {% set evo = '' %}
      {% elif stage <= evolutions | length %}
        {% set evo = evolutions[:stage] | reverse | join('') %}
      {% else %}
        {% set dragons = '🐉' * (stage - (evolutions | length)) %}
        {% set evo = dragons + (evolutions | reverse | join('')) %}
      {% endif %}

      {% set eggs = '🥚' * rem %} {% set final = evo + eggs if streak > 0 else
      '0' %}

      Today:{{ brushes }} Streak:{{ final }}
    tap_action:
      action: more-info

What are good to add later

  • Let brushing ends by manually pressing the button again, if cheating is noticed. – So far not needed.
  • Add a small battery-powered display near the sink to show streaks. Physical visialization would be more powerful feedback for the kid.