Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REQUEST] Historical Data #16

Open
danmed opened this issue Feb 2, 2025 · 5 comments
Open

[REQUEST] Historical Data #16

danmed opened this issue Feb 2, 2025 · 5 comments

Comments

@danmed
Copy link
Contributor

danmed commented Feb 2, 2025

I may work on this myself if i can figure out the python for it..

It would be great to have a simple graph that can display the history of the price comparisons for each day..

first steps :

  • sqlite database or ability to write to external mysql / mariadb database
  • each run writes the 2 values to a new row in the db
  • fields : key, date/time, go price, agile price, current tariff, switch

Once this exists it should be trivial to add in some simple web interface to display the data..

@eelmafia
Copy link
Owner

eelmafia commented Feb 2, 2025

Why not just write out to a csv file on disk and then use that to display your data? A db sounds overkill for something like this

@danmed
Copy link
Contributor Author

danmed commented Feb 2, 2025

Why not just write out to a csv file on disk and then use that to display your data? A db sounds overkill for something like this

even better idea..

@danmed
Copy link
Contributor Author

danmed commented Feb 3, 2025

i think something like this should work.... im struggling to figure out how to test it though. I think if i mount a bind volume to /app then i should be able to easily test the code.

import datetime
csv_datetime = datetime.datetime.now()

csv_potential_cost = total_potential_calculated / 100
csv_current_cost = total_curr_cost / 100
csv_current_tariff = current_tariff 

with open('history.csv', 'a') as f:
    f.write(csv_datetime.strftime("%x") + ',' + csv_current_cost + ',' + csv_potential_cost + ',' + csv_current_tariff + '/n')

@Johnr24
Copy link

Johnr24 commented Feb 3, 2025

who knew reddit would build it's own version of predbat (with extra steps)

@danmed
Copy link
Contributor Author

danmed commented Feb 3, 2025

looks like the new release has changed the code a lot.. i think ill leave this to someone who knows what they are doing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants