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

Correct baseline calc for negative prices #29

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ You should see your display update with the current price!
```
@reboot sleep 10; cd /home/$USER/octopus-agile-pi-prices; /usr/bin/python3 octoprice_main_inky.py > /home/$USER/cron.log
*/30 * * * * sleep 20; cd /home/$USER/octopus-agile-pi-prices; /usr/bin/python3 octoprice_main_inky.py > /home/$USER/cron.log
05 16 * * * cd /home/$USER/octopus-agile-pi-prices; /usr/bin/python3 store_prices.py -r <your region> -t <your tariff> > /home/$USER/cron.log
25 16 * * * cd /home/$USER/octopus-agile-pi-prices; /usr/bin/python3 store_prices.py -r <your region> -t <your tariff> > /home/$USER/cron.log
```
Substituting the tariff and region as before.

Expand Down
8 changes: 4 additions & 4 deletions octoprice_main_inky.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@
#lowest_price_next_24h = min(i for i in prices if i > 0)
lowest_price_next_24h = min(i for i in prices)
if (lowest_price_next_24h < 0):
chart_base_loc = 104 + lowest_price_next_24h*pixels_per_h - 2 # if we have any negative prices, shift the base of the graph up!
chart_base_loc = chart_base_loc + lowest_price_next_24h*pixels_per_h - 2 # if we have any negative prices, shift the base of the graph up!

print("lowest price Position:", prices.index(lowest_price_next_24h))
print("low Value:", lowest_price_next_24h)
Expand Down Expand Up @@ -395,9 +395,9 @@
time_of_cheapest = the_now_local + datetime.timedelta(minutes=min_offset)
print("cheapest at " + str(time_of_cheapest))
print("which is: "+ str(time_of_cheapest.time())[0:5])
time_of_cheapest_formatted = "at " + (str(time_of_cheapest.time())[0:5])
font = ImageFont.truetype(FredokaOne, 16)
draw.text((right_column,101), time_of_cheapest_formatted, inky_display.BLACK, font)
time_of_cheapest_formatted = "Updated " + (str(the_now_local.time())[0:5])
font = ImageFont.truetype(FredokaOne, 11)
draw.text((right_column,105), time_of_cheapest_formatted, inky_display.BLACK, font)


# render the actual image onto the display
Expand Down