Welcome to Tesla Motors Club
Discuss Tesla's Model S, Model 3, Model X, Model Y, Cybertruck, Roadster and More.
Register

Octopus

This site may earn commission on affiliate links.
Do you mind sharing the shortcut? Looking to do similar and select time blocks to send to my Zappi for scheduled timer

I would do but I don't think it will help you much and I can't work out how to extract the Shortcut. Basically all Apple Shortcuts does is ask for some inputs (e.g. max price) and sets some URL GET parameters. The legwork is done in Node Red Flows. Node Red also renews the token every month.

If there's demand I may share the flows (with a few edits). They're crude but functional.
 
Last edited:
  • Like
Reactions: CMc1
I would do but I don't think it will help you much and I can't work out how to extract the Shortcut. Basically all Apple Shortcuts does is ask for some inputs (e.g. max price) and sets some URL GET parameters. The legwork is done in Node Red Flows. Node Red also renews the token every month.

If there's demand I may share the flows (with a few edits). They're crude but functional.
Ah that makes sense. I thought you were pulling direct from Octopus’ API. I keep meaning to look into Node-Red for interactions like this.
+1 for a share. But maybe it’s time I delve further.
 
Would you consider integrating the Tesla Api too?

I'd love to see a recommendation for when to charge my car based on current charge % to charge limit to get the cheapest average rate for charging in a single session.
ev.energy app goes further. It automatically turns charging on and off to optimise cost to get your car charged by the target time based on data from Octopus.
 
  • Like
Reactions: Medved_77 and CMc1
ev.energy app goes further. It automatically turns charging on and off to optimise cost to get your car charged by the target time based on data from Octopus.
Thanks for this, not heard about this solution before so I've set it up.

I picked the Agile tariff but was not asked about my region. I'm assuming as it has my address details it'll work out the Agile rates for the correct region?

Also, I've set my charge threshold to 4p per kWh - will it try to charge when the rate is cheapest or just anytime where the rate falls below the threshold set?
 

Thanks for this, not heard about this solution before so I've set it up.

I picked the Agile tariff but was not asked about my region. I'm assuming as it has my address details it'll work out the Agile rates for the correct region?

Also, I've set my charge threshold to 4p per kWh - will it try to charge when the rate is cheapest or just anytime where the rate falls below the threshold set?
I set it up several months ago, so I can’t quite remember. I just left it on the default settings and the charge periods it chooses match the lowest prices on the screen I see on the Octopus website when logged into my account page. I know this by looking at the history from the JuiceNet app that shows what my EO Mini Pro has been doing.
 
  • Like
Reactions: Medved_77
Working on my personal dash still, mainly formatting/best UI now. As I said, not intending for it be smart or anything, just to sit on a tablet in the kitchen for quick viewing of rates, and via my phone in a nicer/prettier format than the apps I've seen.

And, more than anything, a little lockdown coding project! Haven't needed to fiddle with APIs/json queries before so it's been useful.

8SCDwIE.png
 
Working on my personal dash still, mainly formatting/best UI now. As I said, not intending for it be smart or anything, just to sit on a tablet in the kitchen for quick viewing of rates, and via my phone in a nicer/prettier format than the apps I've seen.

And, more than anything, a little lockdown coding project! Haven't needed to fiddle with APIs/json queries before so it's been useful.

8SCDwIE.png
Excellent!
What you using to display this? I’ve got a Dakboard which I’m looking to show the today’s rates like you’ve got. Already got the cars battery % and solar kW on there. Wonder if this could be converted to jpg then...

I really need to get into the NodeRed game. Was looking at the AWS pricing options. Loads to choose from! Bit overwhelming to begin with
 
Working on my personal dash still, mainly formatting/best UI now. As I said, not intending for it be smart or anything, just to sit on a tablet in the kitchen for quick viewing of rates, and via my phone in a nicer/prettier format than the apps I've seen.

And, more than anything, a little lockdown coding project! Haven't needed to fiddle with APIs/json queries before so it's been useful.

Just curious, have you hard coded the Octopus product (such as AGILE-18-02-21) and tariff codes or deriving them from your account? Looks like tariff code can be derived from product code by pre pending E-1R- and appending the gsp which is available on the account. I'm not a fan of hard coded constants such as E-1R- especially when I don't know what they mean.

I've not noticed a way to get what products were active on a given account, just what products were available.
 
Last edited:
Just curious, have you hard coded the Octopus product (such as AGILE-18-02-21) and tariff codes or deriving them from your account? Looks like tariff code can be derived from product code by pre pending E-1R- and appending the gsp which is available on the account. I'm not a fan of hard coded constants such as E-1R- especially when I don't know what they mean.

I've not noticed a way to get what products were active on a given account, just what products were available.

No, it pulls it all from my personal API key. I was going to make it available for anyone to use (once finished) where you can just pop your own API key in but I know people won't trust that it's not storing them.

Equally happy to make the code open (once absolutely finished!) so you can self-host and see that it doesn't store anything.
 
What api call are you using to get your current product/tariff from your account? I've obviously missed that one. The only thing that I can get for my account is gsp and a list of available tariffs but not the active ones.

Octopus Energy APIs — Octopus Energy API 1.0 documentation

It's a curl. See below:

Code:
$url = 'https://api.octopus.energy/v1/products/AGILE-18-02-21/electricity-tariffs/E-1R-AGILE-18-02-21-L/standard-unit-rates/';
$curl = curl_init($url);

curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, [
  'API_Key: $api_key',
  'Content-Type: application/json'
]);

$response = curl_exec($curl);
curl_close($curl);
 
Thanks

OK, so you hard coded product and tariff codes in the request :(

$url = 'https://api.octopus.energy/v1/products/AGILE-18-02-21/electricity-tariffs/E-1R-AGILE-18-02-21-L/standard-unit-rates/';
$curl = curl_init($url);

I was after an easy way to derive them from my account / mpan without having to make too many assumptions and ensuring that they don't change in the future

fyi, you can get the GSP (the L postfix in the tariff code) from your account so no need to hard code. That at least will make it region independent.

Code:
GET /v1/electricity-meter-points/{mpan}/

returns eg
{
    "gsp": "_H",
    "mpan": "2000024512368",
    "profile_class": 1
}
 
I was after an easy way to derive them from my account / mpan without having to make too many assumptions and ensuring that they don't change in the future
How often you going to be changing your tariff?

Also I believe you can get the data from the account number and API as I’ve seen it pull the day a few times inc the IFTTT octopus onboarding screen (poss also octocompare, not sure where else).
 
I've (more accurately, Octopus has) changed my tariffs at least 5 times this year, 3 of them in the last month.

More significant is how often do Octopus change their tariffs, which is very frequently. Since tariff product and tariff codes contain a date in them, they will change at some point in time.

But thats besides the point. Its an obvious thing to need to do and seems to be an omission that this very useful piece of information is not available. Example use, comparing one tariff against someone's existing tariff. How would you know what the existing tariff was without telling it and this may even change over time.

Nothing in the API that I have seen links a product with an account and/or MPAN. Was wondering if anyone had spotted it or can tell me what the prefix on the product code means.
 
  • Informative
Reactions: Russinating
OCTOPUS AGILE

Plunge pricing tomorrow between 04:30 -06:30 & 13:30 - 16:00!

04:30 05:00 05:30 06:00
-0.00084 -0.01365 -0.01323 -0.00441

13:30 14:00 14:30 15:00 15:30
-0.01302 -0.011445 -0.019635 -0.03087 -0.023415

So 4.5 hours where the price is below zero and a total of 18.5 hours where the price is below 5p pkWh.


Every little helps as they say....