Weekly Chore Tracker with Node-RED: A Family Automation Success Story

Hey everyone, I wanted to share a fun project I’ve been working on with Node-RED in Home Assistant. It’s a weekly chore tracker for my son, complete with allowance tracking and automated email summaries. I’ve been using ChatGPT to help with the YAML configurations, but Node-RED has been a bit tricky to get right. Let me walk you through how I set it up and what I’ve learned along the way!

The Goal

I wanted to create a system that tracks my son’s chores throughout the week, calculates his allowance, and sends a summary email every Saturday. The system should automatically update based on his daily tasks and provide a clear overview of his progress.

The Setup

Here’s a quick overview of how I structured the flow:

  1. Sensors and States: I set up binary sensors for each day of the week to track completed chores. These sensors update dynamically based on his daily tasks.
  2. Data Collection: Using Node-RED, I collect data on completed chores, reading sessions, writing sessions, and extra tasks. This data is stored in variables for easy access.
  3. Allowance Calculation: I created a simple formula to calculate his weekly allowance based on completed tasks. The system updates this value in real-time.
  4. Email Notification: Every Saturday at 23:55, the system generates a summary email with all the data collected throughout the week.

The Challenges

The biggest challenge was getting the email formatting right. Initially, the emails looked messy with missing separators and incorrect formatting. After some trial and error, I figured out how to use newline characters and proper string formatting to make the emails look clean and professional.

The Solution

Here’s a snippet of the Node-RED function I used to generate the email payload:

javascript
msg.payload = {
title: “Owen’s Weekly Chore Summary”,
message: [
“======================================================================”,
Weekly Summary: ${formatDate(startDate)} to ${formatDate(endDate)},
“======================================================================”,
“”,
Total Allowance Earned: $${allowance},
“”,
Required Daily Chores: ${requiredCount} out of 7 days completed,
“”,
Weekly Quota Chores:,
Showers: ${quotaCounts.shower} out of 3 taken,
Reading Sessions: ${quotaCounts.reading} out of 3 completed,
Writing Sessions: ${quotaCounts.writing} out of 3 completed,
“”,
Extra Chores Completed: ${extraTotal}
].join(“\n”)
};

This code ensures that the email is properly formatted with clear sections and separators. The use of escaped newline characters (\\n) was key to getting the formatting right.

The Results

The system has been running smoothly for the past few weeks, and my son loves seeing his progress each week. It’s been a great way to teach him responsibility and basic budgeting skills. Plus, it’s been a fun project to work on!

Tips for Others

  • Start Small: If you’re new to Node-RED, start with a simple project and gradually add complexity.
  • Test Regularly: Use the debug node to test different parts of your flow and ensure everything is working as expected.
  • Use Templates: Node-RED’s template nodes are incredibly useful for formatting outputs like emails.

I’d love to hear if anyone else has similar projects or tips for improving this setup. Happy automating everyone! :rocket: