sensor.chore_list_sensor state attributes looks like this:
Number of chores: 32
Pending chores: 1
Chores:
- chore: test igjen
frequency: Daglig
status: false
poeng: 5
tildelt: No one assigned
prioritet: "1"
- chore: test
frequency: Daglig
status: false
poeng: 5
tildelt: No one assigned
prioritet: "1"
and so on…
The script script.1704543720380 sends a notification.
My problem is that every time it sends me 1 less chore, than the number of chores there are in today_chores. Am I doing anything wrong?
Use the repeat until rather than the repeat while action. The condition in the until action is evaluated after the loop, but it is evaluated before the loop in the while.
Ok that all looks good. I think the problem is that your loop sequence is completing too fast for the message services to complete before they have to process the next loop.
Try adding a delay at the end of your loop actions:
Sorry, had to sleep.
The issue still remained. 3 sent, expecting 4. I am keeping that, though, since it doesn’t spam the phone as much. Thanks. Always the last created chore that doesn’t get sent. When using repeat until, I only get the last 3rd. I never get the first one in the list, which indicates that it doesn’t start looping at 0.
The documentation says for index: “The iteration number of the loop: 1, 2, 3,” so it seems it doesn’t count 0.
I tried adding chore_index as repeat.index - 1. This seems to align repeat.index starting from 1 with the actual list index starting from 0. That worked!