Coder Social home page Coder Social logo

pufferfish-tech / octopus-agile-pi-prices Goto Github PK

View Code? Open in Web Editor NEW
74.0 18.0 27.0 42 KB

Display the upcoming prices on the Octopus Energy "Agile" tariff.

License: Apache License 2.0

Python 100.00%
octopusagile octopus pimoroni raspberry-pi prices agile

octopus-agile-pi-prices's People

Contributors

jerbzz avatar nrbrook avatar pufferfish-tech avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

octopus-agile-pi-prices's Issues

No display :(

Well, im obviously doing something wrong but I have followed the instructions as far as I am aware, to the letter but when I reboot my Pi my Inkyphat screen just stays on its logo and nothing is happening!

The power/data light flashes for a good bit so I know the pi is doing something, but thats all I get.

Anyone else had this or can point me in a direction of how to test everything is installed correctly?

Only issue im getting is as follows:

python3 create_price_db.py

File "create_price_db.py", line 8

^
SyntaxError: invalid syntax

Thanks all

Negative Prices don't work on bar chart

Simple reminder to myself and note to others that negative prices don't show in the bar chart.
They also don't show as "lowest price".
They do however show as now/next/+1 prices so the current price will display correctly.

Obviously some kind of "minimum" issue somewhere to look at when I get round to it, when I wrote this there weren't many negative prices around, nowadays there seems to be!

mim price is that just min price for today?

basically it display 22:30 at 8.6p which is fine however later after 00:00 it is cheaper still. Is that because it only displays today minimum price and not the next 24 hours?

store_prices.py on BST

Hi - Please can you let me know how to get store_prices.py to load agileprices.sqlite with BST times - and so align with agile.octopushome.net/dashboard. Many thanks - Ian

Error - AttributeError: 'module' object has no attribute 'timezone'

Hi all I seem to have an issue running the code:

Traceback (most recent call last):
File "octoprice_main_inky.py", line 33, in
the_now = datetime.datetime.now(datetime.timezone.utc)
AttributeError: 'module' object has no attribute 'timezone'

I believe python installed correctly

support for a 3.5 inch display.

Is your feature request related to a problem? Please describe.
I just purchased a 3.5inch display for a pi 2 model b to display the curerent half hour rate - upcoming rate - current consumption (if the api supports it) - consumption so far on that day (and price....)
The idea was to replace my smart meters out of date monitor that cant show anything beyond current consumption lol

Then I realised I dont know how to do any of that and google lead me here.

Describe the solution you'd like
I would love to be able to display the text like you have it but on a self updating local website hosted on the PI, displayed on the 3.5 inch display. Not sure if such is possible.

Describe alternatives you've considered
sitting in the corner and rocking back and forward slowly.
learning python and how to make a website thats dynamic using python...thats actually a long term thing.
Additional context
I know c#, would be happy to be shown how to get a specific value for the half hour time slot via the api and have it in a variable then pointed in the direction of how to make a website with python that displays that variable on it.... armed with that knowledge i could probably extrapolate the rest.... but i dont know where to begin lol

Your app fills a mysql database, so knowing how to pull a value from that data base and a link to a good noob friendly python website building guide could be all I need?

My first project.

Many thanks.

This was my first Pi project and although it's still work in progress it's been an amazing journey.

I've added the use of a weather API to bring in live weather data to fill in the display.

Added code to deal with negative pricing and displays this as a black outlined clear blocks on the graph.

Also displays the cheapest 2hr block to use dish washers, washing machines etc.

Printed a 3d case.

15906928130571759282277467555134

15906928650148457506243741394825

Minor issue list and my experience installing

I really just wanted to say thanks for this project. I'm so pleased I tried it and it is all up and running for me perfectly.

The only things I noticed when implementing were.

  1. There seems to be no need for an API key, even though the documentation mentions it, there is nowhere in the instructions to put it and it seems to work without.
  2. It didn't recognise my board until I went into raspi-config -> interface options -> enabled SPI and I2C
  3. There is no need to edit the code anymore to set the region like the readme says, you simply just add the region to your daily cron command for updating the prices by adding -r (there's a table of region letters in the code).
  4. The price increases mean that the bar graph now sometimes overlaps the current price and makes it harder to read. I edited the value on line 346 of octoprice_main_inky.py, pixels_per_h = 1.5 (previously the value was 2.3).
  5. Today the prices went negative and over 9.9 which meant it had to display a - symbol and xx.x for the price, this caused the text to overlap the upcoming 30-minute blocks. This will be a rare event, so I'm not too worried, but I might see if there's some way to handle that in future, maybe drop the P or reduce the font size if it goes beyond double digits.

The code comments are brilliant and it was well documented. I really appreciate the creator, thanks so much.

Error message

Hello

I've reinstalled my raspberry OS, but when reinstalling the Octopus Agile script, it throws up a message, which I didn't encounter before....

Detected Red pHAT (High-Temp)
Traceback (most recent call last):
File "octoprice_main_inky.py", line 28, in
DB_URI = 'file:{}?mode=rw'.format(pathname2url('agileprices.sqlite'))
NameError: name 'pathname2url' is not defined

any ideas? Sorry if its obvious, my coding skills are limited.

thanks

James

Notification

Hi, Is there a way to set an alarm or notification of some type. (Via Text or email maybe?)
Or even an action to turn some other hardware on or off via whatever board your using?
I'm thinking for when costs go below a pre determined price or rise to above another predetermined price.

It would give the user a notification to say 'you have cheap electric' so they know to utilise that fact, or obviously, your electric is expensive so they know to turn things off!

I think this would make this software more usable due to the data it receives from the API.

Thanks
Daz

Showing wrong price data

Hi there

I love your code, I'm on Octopus Agile and I was looking for exactly what you programmed. Mine is working, I had to remove '/usr/bin/' from the crontab because there was no such directory. The only thing its showing the wrong price info, my area is the same as yours E-1R-AGILE-18-02-21-A. So Today at 17:20 its displaying 20.5p when it should say 19.47p.

Any suggestions?

Thanks

James

cron issue

Firstly, @pufferfish-tech said:

I must stress that I'm sharing this code for you to expand on, and while it is fully operational (I hope!) it doesn't come with the blessing of having been security audited nor is it supported by octopus energy. It is just something I wrote, that people asked me to share. /disclaimer.

Many thanks for your efforts, much appreciated. I'm not sure I could get my mind in Python around the inky pHAT display.

I had a problem getting the cron jobs to run. The problem was that I had tidied all the project files, into a project sub-directory /home/my_user/agile/, which broke the crontab. In short, the problem says here,

cron runs your command with cwd == $HOME.

It's nice to have individual projects separated in the user dir, into individual sub-dirs, saves much confusion. I fixed my installation by adding at the top of octoprice_main_inky.py:

# Change working directory; added by Chiny
import os
os.chdir("/home/my_user/agile")

Also, I provided the full path to commands in the crontab. Works fine.

Changes to code for non EEPROM InkyPHATs

More of a tip for anyone else who's in the same boat as me! (in the hope that you don't lose hours to trying to make it work). Amazing project and incredibly grateful to the time and effort that has been put into it, it's absolutely perfect for our household now we're on Agile!!

I ended up with an older InkyPHAT that doesn't have an EEPROM chip so the 'auto' sections of octoprice_main_inky.py produce an error.

You need to work out what 'type' of Inky board you have; the easiest way to do that is by trial and error of one of the example Pimoroni scripts; as EEPROM is also used to detect the colour, you need to specify that too otherwise the script can't run; so you'll need to specify that each time too.

Eg cd to the examples folder and run:
python3 logo.py --type {what,phat,phatssd1608,impressions,7colour,whatssd1683,impressions73} --colour {red,black,yellow}

Mine is a red phatssd1608 - so it worked with:
python3 logo.py --type "phatssd1608" --colour "red"

Now you have to lookup the correct Inky class instance, which is what needs to be substituted into the octoprice code
(I found this by looking at /usr/local/lib/python3.9/dist-packages/inky/auto.py but have summarised it here:)

phat -> InkyPHAT
phatssd1608 -> InkyPHAT_SSD1608
what -> InkyWHAT
whatssd1683 -> InkyWHAT_SSD1683
impressions/7colour -> InkyUC8159
impressions73 -> InkyAC073TC1A

[obviously some of these devices wont work with the octoprice layout that is coded!!]

So to make it work with your device you need to change the following lines:

[example given for a red phatssd1608]]

Line 9
from:
from inky.auto import auto
to:
from inky.auto import InkyPHAT_SSD1608

and Line 23
from:
inky_display = auto(ask_user=False, verbose=True)
to:
inky_display = InkyPHAT_SSD1608("red")

And it should work :)

Hope this is helpful to someone else too!

Rich

Can't get past login

This is my first project so apologies for the noobie status. I am desperate to get this up and running. I have flashed the Micro SD with the OS then i am presented with this image.
Image
When I type, no characters appear and I get no further.

I am unsure if its my keyboard or just me!

Congratulations on public recognition

Congratulations @pufferfish-tech on being officially noticed by Octopus Energy. Now there is absolutely no excuse for not fixing the bugs, sorting one or two sub-optimal points ๐Ÿ˜„

Octopus Energy blog.

Incidentally, Octopus Energy show a Raspberry Pi Zero which I find 100% reliable, compared to my daily crash of an older R Pi 2b.

VAT Exclusive Price Shown

Hi,

I'm new to all of this, so hope I'm not making a mistake here....

I noticed the price shown on my Inky pHAT is 10.7p, but the account page on my Octopus Agile says 11.25p. I have looked at the data downloaded from the Octopus API (Area K) and it says the exclusive rate is 10.71p and the inclusive rate is 11.255p.

Then I took a look at store_prices.py - this is where I'm totally clueless - I'm a complete newbie...

The code seems to say it is printing the value including vat to the Inky pHAT??? Is this correct?

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Rotate screen on inkyPhat

Nice to have, easy to include: allow 180 degree rotation of display.

Info from abbottcam:

Iโ€™ve found out how...

https://forums.pimoroni.com/t/inkyphat-display-rotation-command-changed/9675/2

Put this at the bottom of octoprice_main_inky.py

flipped = img.rotate(180)
inky_display.set_image(flipped)
inky_display.show()

Mobile: 07843448046
Website: www.abbottcam.co.uk
IMDb:http://www.imdb.com/name/nm2555732/
โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”
Sent from my iPhone

On 20 Apr 2020, at 11:04, pufferfish-tech [email protected] wrote:

๏ปฟ
It uses PIL which is a standard library so I imagine you can, I am not sure how to though either.

โ€”
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Originally posted by @abbottcam in #2 (comment)

Need ? Octopus Agile API key

I'm still mulling switching to Octopus Agile, as I see I was in January when I hacked a quick Python script together to download the daily prices. I see that I didn't have an Octopus Agile key then, any more than now. So, there appears to be no need for an API key in this code, as stated in the README.md.

I mention this as the project looks interesting, so interesting that I've ordered an Inky pHat. I guess I'm going to find out how it all works the hard way ๐Ÿ˜„

Problems with display not updating

Thank you for all your efforts with this project, it is an excellent project.

I think I have followed everything correctly and I now have the dispay showing the current rate.
However, it doesn't update.
When I SSH in and run the update python3 octoprice_main_inky.py it connects, downloads the current prices and updates the price.

I'm new to programming so really struggling to find the problem with why it won't update.

Cron is set as below:

@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 G -t FLEX-22-11-25 > /home/$USER/cron.log

Edit this file to introduce tasks to be run by cron.

Each task to run has to be defined through a single line

indicating with different fields when the task will be run

and what command to run for the task

To define the time you can provide concrete values for

minute (m), hour (h), day of month (dom), month (mon),

and day of week (dow) or use '*' in these fields (for 'any').

Notice that tasks will be started based on the cron's system

daemon's notion of time and timezones.

Output of the crontab jobs (including errors) is sent through

email to the user the crontab file belongs to (unless redirected).

For example, you can run a backup of all your user accounts

at 5 a.m every week with:

0 5 * * 1 tar -zcf /var/backups/home.tgz /home/

For more information see the manual pages of crontab(5) and cron(8)

m h dom mon dow command

Any help on where to look next much appreciated.
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.