slesinger / HomeAssistant-PREdistribuce

Home Assistant integration to display info about energy plan
https://slesinger.info
Apache License 2.0
11 stars 7 forks source link

Next tariff calculation seems wrong #5

Open mazzy89 opened 3 years ago

mazzy89 commented 3 years ago

I've noticed an error in the calculation. This screenshot is taken at 22.02 UTC+2

Screenshot 2021-09-30 at 21 59 29

It says that the next tariff is in 1420 minutes which does not make much sense because it should be according to the schedules 00:20/01:00

Screenshot 2021-09-30 at 21 59 39 Screenshot 2021-09-30 at 21 59 44
mazzy89 commented 3 years ago

The bug seems that is due to the fact that the calculation is done looking at the tree on the same day. Approaching the end of the day, however, we should make a request to the next page (zitra) and find the right value.

I know that it's not a huge bug because the next day the sensor should pull the right value.

slesinger commented 2 years ago

Thanks for reporting the issue. This fix requires major code change. I will keep this issue open.

mazzy89 commented 2 years ago

No problem. I'm actively using this custom components. Overall it is working. It's not a big deal for the moment because it happens only at the end of the day.