pufferfish-tech / octopus-agile-pi-prices

Display the upcoming prices on the Octopus Energy "Agile" tariff.
Apache License 2.0
85 stars 27 forks source link

Retry if no prices available when checked #7

Open pufferfish-tech opened 4 years ago

pufferfish-tech commented 4 years ago

@Chiny91 - I've hacked the script to incorporate a simple retry method as I found the update was failing regularly.

I'm sure this could be made a lot better, but I'm a relative github/python noob so just learning as I go!

@pufferfish-tech - many thanks for sharing this great project!

Originally posted by @plasma-tech in https://github.com/pufferfish-tech/octopus-agile-pi-prices/issues/4#issuecomment-628829824

sidewinder42 commented 4 years ago

My fix for this issue was to just a run the update script every hour from 4pm to 10pm! It works a treat!

Chiny91 commented 4 years ago

The problem, probably not a big problem, is that that multiple updating of the price database, makes the database multiple times bigger, and currently it is never pruned.

Having said that, I get the database at 5:nn pm and 7.nn pm, which doubles the size of the database but also works.

beararmy commented 4 years ago

If you're getting duplicates can you not do something like I've done Here to check for pre-existance as part of the INSERT

Admittedly that's mariadb, but I think it's fairly generic SQL

pufferfish-tech commented 4 years ago

Yeah it's what I intend to do, I'm just totally unfamiliar with sqlite (I'm also a mysql/mariadb person). If anyone knows the syntax for SQLite I'll be very appreciative ;)

pufferfish-tech commented 4 years ago

Also you can delete the SQLite db at any time btw, just rerunning create_price_db to initialise it as per the readme. So, it growing too big isn't a massive deal - for now.