# How to display a kids roster?

Hi Guys,

This is has me stumped…

We’ve got twins, so have the daily battle of who does what task on a weekly rotating schedule.

How on earth can I create a sensor for one kid to empty the dishwasher on alternating weeks.

I guess to better describe, how do I get a sensor to display one kids name for odd weeks, and the other for even weeks

Ideally, I’d have the task name, and each week, the kid’s name against it would change according to the alternating week.

The issue is when there is 53 weeks in a year.
I assume it’s better to say “it should change each week”, right?

You could create a table with 2 columns.
Fill the tasks in the rows shared accross the columns.

Use 2 templates as the column headings and calculate the odd/even week to assign one kids name for column 1 and the other for column 2 …

Yep, exactly this…

Use 2 input selects with the 2 kids names as options
then on Monday morning run an automation that swaps the values

And monday afternoon one kid changes the input manually

Just to be clear, the actual task to do the change is not the hard part.
The issue is to make sure it can’t be tampered with and works as expected even after a reboot or new years eve.

In its most basic form:

``````{{ 'John' if now().isocalendar()[1] % 2 == 0 else 'Mary' }}
``````

`now().isocalendar()[1]` reports the week number. The `% 2 == 0` tests if the number is even.

The limitation is, as Hellis81 mentioned, the transition from one year to the next if the first year has 53 weeks. That’s an odd number and then the first week of the next year is also an odd number. Whoever is assigned to do tasks on odd weeks, will get them two weeks in a row.

Speaking as a father of 5 daughters and a son, I can tell you that the solution to this is quite simple. You make a list of all the chores and tell them they are BOTH responsible for the entire list. If anything is left undone or done incorrectly, they BOTH suffer the consequences. If everything is done correctly, they BOTH get the rewards. They will learn teamwork and divide the chores between themselves or they will kill each other. Either way, problem solved.

3 Likes

this isn’t a parenting thing though, no issues there… This is a “who’s week is it to put out the compost bin, or who’s week is it to have the first bath” - to an 8 year old, apparently that’s important…

I reckon this is exactly what I need - is this the best way to do it?

``````alias: Flip Week
description: ''
trigger:
- platform: time
at: '01:00:00'
condition:
- condition: time
weekday:
- mon
action:
- service: input_select.select_next
target:
entity_id: input_select.childname
mode: single

``````

And how do I get it to be resilient to HA restarts, or does that happen naturally?

If you don’t define an initial state it should “just work”

will give it a crack - thank you

I think this method should always work.

It’s kind of based what Taras wrote. A modulo of 2 but on the week since UNIX 0.

``````{{ 'John' if (now().timestamp()  / 604800) | int % 2 == 0 else 'Mary' }}
``````

604800 is the number of seconds in a (normal) week.
Because it’s based on normal weeks then it could mean that it will be slightly delayed at daylight savings days (I think).

I just noticed the first of January 1970 was a Thursday so this didn’t work.
So we need to subtract almost four days from the timestam.

``````{{ 'John' if ((now().timestamp()-(86400*3)-79200)  / 604800) | int % 2 == 0 else 'Mary' }}
``````

I can confirm that it does “just work”

1 Like