Refactor chore tracker for new kids: Emma, Liam, and Zoe
- Updated dashboard YAML to reflect new kids and their chores. - Modified chores configuration to include new kids with appropriate icons and settings. - Adjusted generation script to handle new MDI glyphs for icons. - Revised Home Assistant integration to support new kids, including input buttons and automation for chores. - Ensured all references to old kids (Jordyn, Declan, Chloe) are replaced with new names and corresponding logic.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
################################################################################
|
||||
# chore-tracker-dashboard.yaml (AUTO-GENERATED — edit chores_config.yaml)
|
||||
# Kids: Jordyn, Declan, Chloe
|
||||
# Kids: Emma, Liam, Zoe
|
||||
################################################################################
|
||||
|
||||
title: "Chore Tracker"
|
||||
@@ -13,26 +13,26 @@ views:
|
||||
cards:
|
||||
- type: markdown
|
||||
content: >
|
||||
### 😺 Jordyn
|
||||
### Emma
|
||||
{{
|
||||
'All done!' if states('sensor.jordyn_all_chores_done') == 'True'
|
||||
else states('sensor.jordyn_chores_done_today') ~ '/5 chores done'
|
||||
'All done!' if states('sensor.emma_all_chores_done') == 'True'
|
||||
else states('sensor.emma_chores_done_today') ~ '/5 chores done'
|
||||
}}
|
||||
|
||||
- type: markdown
|
||||
content: >
|
||||
### 🤓 Declan
|
||||
### Liam
|
||||
{{
|
||||
'All done!' if states('sensor.declan_all_chores_done') == 'True'
|
||||
else states('sensor.declan_chores_done_today') ~ '/4 chores done'
|
||||
'All done!' if states('sensor.liam_all_chores_done') == 'True'
|
||||
else states('sensor.liam_chores_done_today') ~ '/4 chores done'
|
||||
}}
|
||||
|
||||
- type: markdown
|
||||
content: >
|
||||
### 🌝 Chloe
|
||||
### Zoe
|
||||
{{
|
||||
'All done!' if states('sensor.chloe_all_chores_done') == 'True'
|
||||
else states('sensor.chloe_chores_done_today') ~ '/6 chores done'
|
||||
'All done!' if states('sensor.zoe_all_chores_done') == 'True'
|
||||
else states('sensor.zoe_chores_done_today') ~ '/6 chores done'
|
||||
}}
|
||||
|
||||
- type: button
|
||||
@@ -44,90 +44,90 @@ views:
|
||||
target:
|
||||
entity_id: input_button.reset_all_chores
|
||||
- type: entities
|
||||
title: "😺 Jordyn's Chores"
|
||||
title: " Emma's Chores"
|
||||
entities:
|
||||
- entity: switch.chore_tracker_jordyn_make_bed
|
||||
name: "🛏️ Make Bed"
|
||||
- entity: switch.chore_tracker_emma_make_bed
|
||||
name: " Make Bed"
|
||||
|
||||
- entity: switch.chore_tracker_jordyn_brush_teeth
|
||||
name: "🦷 Brush Teeth"
|
||||
- entity: switch.chore_tracker_emma_brush_teeth
|
||||
name: " Brush Teeth"
|
||||
|
||||
- entity: switch.chore_tracker_jordyn_tidy_room
|
||||
name: "🧹 Tidy Room"
|
||||
- entity: switch.chore_tracker_emma_tidy_room
|
||||
name: " Tidy Room"
|
||||
|
||||
- entity: switch.chore_tracker_jordyn_homework
|
||||
name: "📚 Homework"
|
||||
- entity: switch.chore_tracker_emma_homework
|
||||
name: " Homework"
|
||||
|
||||
- entity: switch.chore_tracker_jordyn_feed_dog
|
||||
name: "🐾 Feed Dog"
|
||||
- entity: switch.chore_tracker_emma_feed_dog
|
||||
name: " Feed Dog"
|
||||
- type: divider
|
||||
- entity: sensor.jordyn_chores_done_today
|
||||
- entity: sensor.emma_chores_done_today
|
||||
name: "Chores done today"
|
||||
- entity: sensor.jordyn_all_chores_done
|
||||
- entity: sensor.emma_all_chores_done
|
||||
name: "All Done?"
|
||||
- type: button
|
||||
name: "Reset Jordyn's Chores"
|
||||
name: "Reset Emma's Chores"
|
||||
tap_action:
|
||||
action: call-service
|
||||
service: input_button.press
|
||||
target:
|
||||
entity_id: input_button.jordyn_reset_chores
|
||||
entity_id: input_button.emma_reset_chores
|
||||
- type: entities
|
||||
title: "🤓 Declan's Chores"
|
||||
title: " Liam's Chores"
|
||||
entities:
|
||||
- entity: switch.chore_tracker_declan_make_bed
|
||||
name: "🛏️ Make Bed"
|
||||
- entity: switch.chore_tracker_liam_make_bed
|
||||
name: " Make Bed"
|
||||
|
||||
- entity: switch.chore_tracker_declan_brush_teeth
|
||||
name: "🦷 Brush Teeth"
|
||||
- entity: switch.chore_tracker_liam_brush_teeth
|
||||
name: " Brush Teeth"
|
||||
|
||||
- entity: switch.chore_tracker_declan_set_table
|
||||
name: "🍽️ Set Table"
|
||||
- entity: switch.chore_tracker_liam_set_table
|
||||
name: " Set Table"
|
||||
|
||||
- entity: switch.chore_tracker_declan_take_out_trash
|
||||
name: "🗑️ Take Out Trash"
|
||||
- entity: switch.chore_tracker_liam_take_out_trash
|
||||
name: " Take Out Trash"
|
||||
- type: divider
|
||||
- entity: sensor.declan_chores_done_today
|
||||
- entity: sensor.liam_chores_done_today
|
||||
name: "Chores done today"
|
||||
- entity: sensor.declan_all_chores_done
|
||||
- entity: sensor.liam_all_chores_done
|
||||
name: "All Done?"
|
||||
- type: button
|
||||
name: "Reset Declan's Chores"
|
||||
name: "Reset Liam's Chores"
|
||||
tap_action:
|
||||
action: call-service
|
||||
service: input_button.press
|
||||
target:
|
||||
entity_id: input_button.declan_reset_chores
|
||||
entity_id: input_button.liam_reset_chores
|
||||
- type: entities
|
||||
title: "🌝 Chloe's Chores"
|
||||
title: " Zoe's Chores"
|
||||
entities:
|
||||
- entity: switch.chore_tracker_chloe_make_bed
|
||||
name: "🛏️ Make Bed"
|
||||
- entity: switch.chore_tracker_zoe_make_bed
|
||||
name: " Make Bed"
|
||||
|
||||
- entity: switch.chore_tracker_chloe_brush_teeth
|
||||
name: "🦷 Brush Teeth"
|
||||
- entity: switch.chore_tracker_zoe_brush_teeth
|
||||
name: " Brush Teeth"
|
||||
|
||||
- entity: switch.chore_tracker_chloe_water_plants
|
||||
name: "🌱 Water Plants"
|
||||
- entity: switch.chore_tracker_zoe_water_plants
|
||||
name: " Water Plants"
|
||||
|
||||
- entity: switch.chore_tracker_chloe_homework
|
||||
name: "📚 Homework"
|
||||
- entity: switch.chore_tracker_zoe_homework
|
||||
name: " Homework"
|
||||
|
||||
- entity: switch.chore_tracker_chloe_tidy_room
|
||||
name: "🧹 Tidy Room"
|
||||
- entity: switch.chore_tracker_zoe_tidy_room
|
||||
name: " Tidy Room"
|
||||
|
||||
- entity: switch.chore_tracker_chloe_practice_piano
|
||||
name: "🎹 Practice Piano"
|
||||
- entity: switch.chore_tracker_zoe_practice_piano
|
||||
name: " Practice Piano"
|
||||
- type: divider
|
||||
- entity: sensor.chloe_chores_done_today
|
||||
- entity: sensor.zoe_chores_done_today
|
||||
name: "Chores done today"
|
||||
- entity: sensor.chloe_all_chores_done
|
||||
- entity: sensor.zoe_all_chores_done
|
||||
name: "All Done?"
|
||||
- type: button
|
||||
name: "Reset Chloe's Chores"
|
||||
name: "Reset Zoe's Chores"
|
||||
tap_action:
|
||||
action: call-service
|
||||
service: input_button.press
|
||||
target:
|
||||
entity_id: input_button.chloe_reset_chores
|
||||
entity_id: input_button.zoe_reset_chores
|
||||
|
||||
|
||||
@@ -3,12 +3,30 @@
|
||||
#
|
||||
# Edit this file to change kids, chores, and settings.
|
||||
# Then run: python3 generate.py
|
||||
#
|
||||
# ICONS: Use MDI codepoints from https://pictogrammers.com/library/mdi/
|
||||
# Format: "\U000FXXXX" e.g. mdi:bed = "\U000F02E3"
|
||||
# The kid avatar field also uses MDI codepoints.
|
||||
#
|
||||
# Common chore icons:
|
||||
# Bed: "\U000F02E3" mdi:bed
|
||||
# Brush teeth: "\U000F09A9" mdi:toothbrush
|
||||
# Broom: "\U000F00A8" mdi:broom
|
||||
# Book: "\U000F0219" mdi:book-open-variant
|
||||
# Dog: "\U000F01F9" mdi:dog
|
||||
# Paw: "\U000F0265" mdi:paw
|
||||
# Silverware: "\U000F03E7" mdi:silverware-fork-knife
|
||||
# Trash: "\U000F05B8" mdi:trash-can
|
||||
# Watering can: "\U000F1B25" mdi:watering-can
|
||||
# Piano: "\U000F0F9E" mdi:piano
|
||||
# Dumbbell: "\U000F0F1E" mdi:dumbbell
|
||||
# Shower: "\U000F0467" mdi:shower
|
||||
################################################################################
|
||||
|
||||
settings:
|
||||
device_name: chore-tracker
|
||||
friendly_name: "Chore Tracker"
|
||||
wifi_ssid: !secret wifi_iot_ssid
|
||||
wifi_ssid: !secret wifi_ssid
|
||||
wifi_password: !secret wifi_password
|
||||
api_key: !secret api_encryption_key
|
||||
ota_password: !secret ota_password
|
||||
@@ -17,54 +35,54 @@ settings:
|
||||
notify_service: notify.notify
|
||||
|
||||
# ── KIDS ──────────────────────────────────────────────────────────────────────
|
||||
# Each kid has their own chore list.
|
||||
# name, avatar, color, color_dark, and chores are all required.
|
||||
# avatar: MDI codepoint shown in the sidebar on the kid's chore page
|
||||
# color / color_dark: hex colours for that kid's sidebar
|
||||
#
|
||||
kids:
|
||||
- name: Jordyn
|
||||
avatar: "😺"
|
||||
- name: Emma
|
||||
avatar: "\U000F01F9" # mdi:dog
|
||||
color: "4D96FF"
|
||||
color_dark: "2A6FCC"
|
||||
chores:
|
||||
- name: Make Bed
|
||||
icon: "🛏️"
|
||||
icon: "\U000F02E3" # mdi:bed
|
||||
- name: Brush Teeth
|
||||
icon: "🦷"
|
||||
icon: "\U000F09A9" # mdi:toothbrush
|
||||
- name: Tidy Room
|
||||
icon: "🧹"
|
||||
icon: "\U000F00A8" # mdi:broom
|
||||
- name: Homework
|
||||
icon: "📚"
|
||||
icon: "\U000F0219" # mdi:book-open-variant
|
||||
- name: Feed Dog
|
||||
icon: "🐾"
|
||||
icon: "\U000F0265" # mdi:paw
|
||||
|
||||
- name: Declan
|
||||
avatar: "🤓"
|
||||
- name: Liam
|
||||
avatar: "\U000F0C99" # mdi:cat
|
||||
color: "C77DFF"
|
||||
color_dark: "8B42CC"
|
||||
chores:
|
||||
- name: Make Bed
|
||||
icon: "🛏️"
|
||||
icon: "\U000F02E3" # mdi:bed
|
||||
- name: Brush Teeth
|
||||
icon: "🦷"
|
||||
icon: "\U000F09A9" # mdi:toothbrush
|
||||
- name: Set Table
|
||||
icon: "🍽️"
|
||||
icon: "\U000F03E7" # mdi:silverware-fork-knife
|
||||
- name: Take Out Trash
|
||||
icon: "🗑️"
|
||||
icon: "\U000F05B8" # mdi:trash-can
|
||||
|
||||
- name: Chloe
|
||||
avatar: "🌝"
|
||||
- name: Zoe
|
||||
avatar: "\U000F17B5" # mdi:teddy-bear
|
||||
color: "FF6B9D"
|
||||
color_dark: "CC3A6F"
|
||||
chores:
|
||||
- name: Make Bed
|
||||
icon: "🛏️"
|
||||
icon: "\U000F02E3" # mdi:bed
|
||||
- name: Brush Teeth
|
||||
icon: "🦷"
|
||||
icon: "\U000F09A9" # mdi:toothbrush
|
||||
- name: Water Plants
|
||||
icon: "🌱"
|
||||
icon: "\U000F1B25" # mdi:watering-can
|
||||
- name: Homework
|
||||
icon: "📚"
|
||||
icon: "\U000F0219" # mdi:book-open-variant
|
||||
- name: Tidy Room
|
||||
icon: "🧹"
|
||||
icon: "\U000F00A8" # mdi:broom
|
||||
- name: Practice Piano
|
||||
icon: "🎹"
|
||||
icon: "\U000F0F9E" # mdi:piano
|
||||
@@ -122,6 +122,13 @@ def gen_esphome(cfg: dict) -> str:
|
||||
lvgl_pages = _gen_lvgl_pages(kids)
|
||||
scripts = _gen_scripts(kids)
|
||||
|
||||
# Collect all unique MDI glyphs used (avatars + chore icons)
|
||||
all_glyphs = sorted(set(
|
||||
[k["avatar"] for k in kids] +
|
||||
[c["icon"] for k in kids for c in get_chores(k)]
|
||||
))
|
||||
glyphs_str = "".join(all_glyphs)
|
||||
|
||||
return f"""\
|
||||
################################################################################
|
||||
# chore-tracker-esphome.yaml (AUTO-GENERATED — edit chores_config.yaml)
|
||||
@@ -255,6 +262,17 @@ font:
|
||||
- file: "fonts/Nunito-SemiBold.ttf"
|
||||
id: font_tiny
|
||||
size: 13
|
||||
# MDI icon font — used for chore icons and kid avatars
|
||||
- file: "fonts/materialdesignicons-webfont.ttf"
|
||||
id: font_mdi_large
|
||||
size: 48
|
||||
bpp: 4
|
||||
glyphs: {glyphs_str}
|
||||
- file: "fonts/materialdesignicons-webfont.ttf"
|
||||
id: font_mdi_small
|
||||
size: 32
|
||||
bpp: 4
|
||||
glyphs: {glyphs_str}
|
||||
|
||||
# ── Switches — backlight raw + one per chore per kid ─────────────────────────
|
||||
switch:
|
||||
@@ -336,7 +354,7 @@ def _gen_lvgl_pages(kids: list) -> str:
|
||||
align: CENTER
|
||||
y: -45
|
||||
text: "{kid['avatar']}"
|
||||
text_font: font_title
|
||||
text_font: font_mdi_large
|
||||
- label:
|
||||
align: CENTER
|
||||
y: 22
|
||||
@@ -443,7 +461,7 @@ def _gen_lvgl_pages(kids: list) -> str:
|
||||
align: CENTER
|
||||
y: {icon_y}
|
||||
text: "{chore['icon']}"
|
||||
text_font: font_med
|
||||
text_font: font_mdi_small
|
||||
- label:
|
||||
align: CENTER
|
||||
y: {label_y}
|
||||
@@ -475,7 +493,7 @@ def _gen_lvgl_pages(kids: list) -> str:
|
||||
width: {sidebar_w}
|
||||
align: TOP_MID
|
||||
text: "{kid['avatar']}"
|
||||
text_font: font_title
|
||||
text_font: font_mdi_large
|
||||
- label:
|
||||
x: 0
|
||||
y: 76
|
||||
|
||||
Reference in New Issue
Block a user