A Simple Task List for Adults

Now I don’t know about you, but when I get to about three weeks after doing something, I have forgotten I have done it. I have no idea why the last five years have turned me into a much of forgetfulness, but I am just going to blame it on an abundance of free time during COVID lockdowns and the copious amounts of mind-numbing alcohol that was consumed!

(… and who can blame me, the weather that first summer led to copious amounts of garden time with a glass of ice and bottle of single malt …)

A Use-Case – The Brita Water Filter

Either way, I needed a way to keep a track of all the really important dates that I have done things. Take our Brita water filters for instance. Back when we bought the jug – and the kettle – it was at a time when the replaceable filters were advertised as being for around 30 days and the small digital displays and LEDs are configured for pretty much that.

So when Brita brought out their updated Pro filters, the Pro (Hard Water) filters and the Pro (Limescale Expert) filters; they are now apparently good for 60 days. You know I would not be able to remember if I changed the filters 30 days ago or 60!

So I set about using my Home Assistant build on the Raspberry Pi to configure a really simple way to remember about this and other tasks. As an added bonus I also have a spare tablet screen to be able to set up specifically for this task, although as you can probably guess, the Good Lady Wife is very much “we don’t need more bl**dy screens around the house” because she does not want to have reminders about changing the bedding!

The Baked-In Solutions

Firstly, I want to point out that there are some ways of achieving this in the Home Assistant operating system already.

There is a To-do system already built in and you could either do in and manually add something to the to-do list each time and add a due date.

I think that is a little bit fiddly though, and as soon as we have masses of different lists it will probably get a little cumbersome.

Also, I wanted to experiment.

The 3rd Party Integrations

For the children in the house, I use the Kids Chores integration for Home Assistant. This should – at least in theory – provide them an opportunity to earn some pocket money for sweets, holidays and buying me the occasional bottle of Scotch.

Okay, not the Scotch.

As you can see, my children do not see the value of the gamification of chores; they can each earn £15 a week by doing basic things, but I have not yet got them to five….

The section of the dashboard in the screenshot is actually included in the core set-up of the integration, such is the detail the author of it went to!

But I wanted to Experiment

I also did not want to start messing around with the Kids Chores app and start complicating what is set up for the children. Also I do not want to be paying a spouse pocket money! She can go earn her own!

So I set about trying to work out what would be a fairly simple way of managing the “adult chores” that give us simple reminders of what has been done and what is due to be done.

The Task List for the Task List

So there were a number of steps that I wanted to make sure are in place, for the simple reason that I wanted to not only make it robust, but also have it easy to use. We are using a number of touch screens around the house, so making sure that it can not be accidentally triggered and the filtered water goes too long without a change.

So I considered:

  • Ensuring a task was completed and then an element of confirmation, so that if someone selected the wrong one there is a way back.
  • Ensuring that a due date is visible
  • Making sure there is a record in the background of things being done

The Elements I Used

So there are a number of Home Assistant Helpers that I am using to manage this simple solution. For each individual task – which for the example I will use changing the Brita filter I will have:

  • A button input for Brita filter in /config/helpers to manage the dashboard buttons
  • A datetime input for Brita filter in /config/helpers to track the next due dates
  • A script for the Brita filter in /config/script/dashboard to manage the tasks
  • A button on the dashboard to trigger it all

Creating the button and the datetime helper should be fairly straight forward. It was not necessary for us, but I created the datetime helper to incorporate the time for each task but it really was not needed.

The Script

The most important factor in my mind for the script is to work out how long between due dates you want because otherwise it is simply a case of copy the script and adjust the helper names. For those not used to Home Assistant yet, you can either build scripts in a visual interface, or write directly in YAML markup. I chose the later and this is what it looks like:

alias: Brita Filter Change
sequence:
  - target:
      entity_id: input_datetime.brita_filter_change
    data:
      datetime: "{{ (now() + timedelta(days=60)).strftime('%Y-%m-%d %H:%M') }}"
    action: input_datetime.set_datetime
  - data:
      title: Brita Filter Changed
      message: >-
        Brita Filters due next: {{ (now() + timedelta(days=60)).strftime('%B %d,
        %Y') }}
      notification_id: brita_filter_change
    action: persistent_notification.create
description: Date & Time management for Brita Filter Changing

For those that might be new to scripting in YAML or exploring the possibilities for the first time, let’s break this down:

  • I ask the script to target the datetime input and in this case set the next due date, which is 45 days into the future to the specific format that Home Assistant uses ( Year – Month – Day Hour : Minute)
  • I then get the script to place a notification in the Home Assistant (if you are using the notifications in the app available for Android or iOS) to say it has been done

Let’s be honest, if you were really worried about whether a task was done, you could also check the built in log-book (at /logbook )

The Button

So in terms of placing a button on the dashboard, I have also taken things the extra step. I have added colour to the buttons so that they are:

  • Green when they are not yet due
  • Yellow on the day they are due
  • Red when they are overdue
  • Grey if unknown or unsure

I have also ensured that the text to match the colour of the button is contrasting; black on yellow and white on green / red.

type: custom:button-card
entity: input_button.brita_filter_change
name: Brita Filter Change
icon: mdi:water
show_state: false
tap_action:
  action: call-service
  service: script.brita_filter_change_2
  confirmation:
    text: Has the Brita Filter been Changed?
styles:
  card:
    - height: 100px
    - background-color: |
        [[[
          const nextDue = states['input_datetime.brita_filter_change'].state;
          if (!nextDue) return 'grey'; // fallback color
          const dueDate = new Date(nextDue);
          const today = new Date();
          today.setHours(0,0,0,0);
          dueDate.setHours(0,0,0,0);

          if (dueDate < today) {
            return 'red'; // overdue
          } else if (dueDate.getTime() === today.getTime()) {
            return 'yellow'; // due today
          } else {
            return 'green'; //due in future
          }
        ]]]
    - font-size: 28px
    - color: |
        [[[
          const nextDue = states['input_datetime.brita_filter_change'].state;
          if (!nextDue) return 'white';
          const dueDate = new Date(nextDue);
          const today = new Date();
          today.setHours(0,0,0,0);
          dueDate.setHours(0,0,0,0);
          return dueDate < today ? 'white' : dueDate.getTime() === today.getTime() ? 'black' : 'white';
        ]]]
  icon:
    - color: |
        [[[
          const nextDue = states['input_datetime.brita_filter_change'].state;
          const dueDate = new Date(nextDue);
          const today = new Date();
          return dueDate <= today ? 'red' : 'green';
        ]]]
label: |
  [[[
    const nextDue = states['input_datetime.brita_filter_change'].state;
    if (!nextDue) return "Next due: Unknown";
    const dueDate = new Date(nextDue);
    // Format as DD MMM YYYY
    return "Next due: " + dueDate.toLocaleDateString('en-GB', { year: 'numeric', month: 'short', day: 'numeric' });
  ]]] 
show_label: true

Pressing this button offers the script that we have previously written, giving the confirmation prompt box. Once the user confirms that the task is complete, the script updates the datetime helper with the new due date and the button automatically updates both the due date and the colour.

Obviously you can change variables to your hearts content, however for a low vision user, I found that a font size of 28 and having two buttons on each row fits quite nicely on a 10-inch tablet such as the old Samsung Tab A6 (from 2016) that I am using here.

As you can see, it is probably now time I go and change the bedding!

A screenshot of adult chore buttons in Home Assistant.

Leave a comment