elden1337 / hass-peaqnext

Utility sensors to help find the next best usage of your appliances
Other
7 stars 0 forks source link

Period keeps changing #25

Closed nord- closed 1 year ago

nord- commented 1 year ago

I don't understand why the best/cheapest period keeps changing every minute. image

A minute later: image

Am I doing something wrong?

Also, it does not seem to pick the cheapest period:

image
elden1337 commented 1 year ago

Hi.

The price diff is most likely due to #19 in your case.

The price does update every minute to accommodate the starting time better (ie now might still be cheapest even if it's 13:06, but not necessarily. Would you require that to be a setting?

nord- commented 1 year ago

I don't understand the logic behind it... If the calculation finds that 18:56 is the best start-time, why does it find 18:57 to be better a minute later? Now a couple (4) hours later it says 18:15-19:45 to be the best, but the prices have not changed... It seems to be chasing the minutes. At 13:15 it says 18:15, and now while I'm writing this the time is 13:18 and Peaqnext suggest 18:18 as a new start time.

If I calculate this myself, the dishwasher cycle is 90 minutes and the cheapest hours are between 23-00 (-0,03) and the second cheapest is 22-23 (-0,02), so I would say 22:30-00:00 should be the "correct" answer, and should not change until the prices are updated or a couple of minutes (at least one) after the start-time (to prevent timing issues where "start" is never triggered).

elden1337 commented 1 year ago

You might be right that the future starts don't have to be recalculated. The present start however is imo not valid if it says 13:00 and it's now 13:06.

I'm guessing an option is what would make it work better.

In my usecase for example the dishwasher has full hour delays in start. In that case it's better to get the future options changed to current minute as well.

groen-sb commented 1 year ago

I think an option would be a good idea, because for different appliances the settings will be different. Another option to add maybe: For my dryer I can set an end time (in full hours from 'now'). For example: the drying program takes 1 hour and 10 minutes. I can set the end time to 4 hours from now. so the machine will start in 2 hours and 50 minutes.

elden1337 commented 1 year ago

I'll see what i can come up with

elden1337 commented 1 year ago

image

What would your preferred action be in this case @nord- ? should it say 22 as next possibility (21 is not in the list now) since 21:00 has passed, or should it still say 21:00?

elden1337 commented 1 year ago

first is minute-update, second is hourly

nord- commented 1 year ago

Since 22 is cheaper than 21:06 the latter shouldn't be an option at all, or am I missing something?

elden1337 commented 1 year ago

Ignore the first row that's a minute sensor. But when time is 6min past the hour, should it still be possible to get 21:00 as preferred start or should it be at least 22? Ie for how long after the hour would you like the state to remain?

nord- commented 1 year ago

If 21 remains a minute, that would suffice (21:01). The problem I had with my own sensors were that if both triggered/changed at 21 the "start" would never trigger because at the exact same moment the time changed to something in the future… 😞

elden1337 commented 1 year ago

image here are all four options working for both your cases @nord- @sjoukebakker setable in config flow. gonna push release soon.