Runtime optimisation on per week basis

Let’s say I need to have a device to be running 10 hours a week and I usually let it run 2 hours a day. Some days it will not run at all, other weeks it will run 14 hours. So from 0 to 14 hours is both possible.

I need a sensor template that accumulates the runtime of the last 7 days. If the runtime is too low in the last days to achieve that it would extend the runtime per day to compensate. Target time will be 10 hours, but there is a limit per day.

It is a bit of a complex task - or at least I am stuck in finding a way to do that in HA.

This would probably be of use, with the end set to now() and the duration 7 days.

You will need to make sure the recorder purge setting is not below 7 days though. The default is 10 days, so if you did not change that you should be fine.

1 Like