InventoCasa / ha-advanced-blueprints

Advanced Blueprints combined with pyscript for extra useful automations
166 stars 35 forks source link

Support miniumum and maxiumum run time #32

Open alistair23 opened 1 year ago

alistair23 commented 1 year ago

Pool pumps and other devices have a minimum and maximum number of hours they need to run in a day.

That is even if there is no sun the device must run for X (minimum) number of hours and even if there is excess sun it doesn't need to run more then Y (maximum) number of hours.

It would be great to support optional minimum and maximum run times.

I'm thinking it could be doable by implementing a run counter when devices are turned on and off. The just adding a check for maximum runtime before starting the device. Then the minimum could be supported by adding another loop in the trigger factory that kicks in after a specified time (the time when electricity becomes cheaper)

Kolbi commented 1 year ago

I would also like to have such a feature.

alistair23 commented 1 year ago

I have a fork that supports min/max runtime: https://github.com/alistair23/ha-advanced-blueprints/tree/alistair/min-max-runtime

I'm working on upstreaming changes, but this repo seems to be unmaintained

InventoCasa commented 1 year ago

Hi there, the repo ist still maintained but I don't have time to look into new features/ PRs at the moment. This may get better in the colder months this year (from approx. October on). Till then I can only spare time to fix bugs, in case there are any.

Kolbi commented 1 year ago

If maybe @alistair23 provides a PR, @InventoCasa can merge it maybe?

Otherwise @alistair23 I will try your repo, till @InventoCasa has time to update his :)

GeorgeBark commented 11 months ago

@alistair23 is your fork working properly? I am also interested in this, not sure if you are still developing and testing or if I can already use yours. Also, I see a cron for 20:00 to check the time, can this be configurable? as in, check if it hasn't reached the minimum at 3am instead of at 8pm.

Thanks!

alistair23 commented 11 months ago

Yes, it is. I'm using it every day and it is actively tested and developed: https://github.com/alistair23/homeassistant-helpers

I have added a few useful features related to min and max.

You can easily change the time in the script. I'm trying to remove all of the configuration options as it makes it difficult to have multiple automations. But 3AM seems pretty late. You only have a few hours to meet the minimum run time before the sun rises again.

mzst123 commented 11 months ago

Hi, I am also interested in this. It would also be nice to have a summer/winter schedule, because in my situation for example, in the colder months, the pool does not need to run for as many hours as during summer. Is this easy to do?

Another question, to update, do I just copy the new files over or do I have to redo the automation completely? Thank you

InventoCasa commented 11 months ago

Will integrate this into my next release of the script. Thanks for contributing @alistair23

alistair23 commented 11 months ago

It would also be nice to have a summer/winter schedule, because in my situation for example, in the colder months, the pool does not need to run for as many hours as during summer. Is this easy to do?

It's not that hard to do. Figuring out what are the colder months are is probably the hardest part. Exposing a UI to set the different times is a bit clunky as well

Another question, to update, do I just copy the new files over or do I have to redo the automation completely?

Both, you will need to copy the files over and then update the automation to get the new settings

alistair23 commented 11 months ago

Will integrate this into my next release of the script. Thanks for contributing @alistair23

The PR is open, so just merge it whenever

nicorusti commented 4 months ago

+1 for this feature, would be indeed helpful for pumps!