Hey!
Has anyone managed to integrate with the octopus energy API?
Aydan
Hey!
Has anyone managed to integrate with the octopus energy API?
Aydan
WhyAyden, did you get any progress on this? I too would love to be able to receive my cheap rates
Hello, no I did not
I ended up going back to HomeAssistant as it was more what i wanted.
Thanks for replying, if I get anywhere i will let you know.
Hello, did you manage to make any progress?
Ok so I have made progress sort of. It is a long winded way but I have a solution. I got chat gPT to write me an application that I have running on a raspberry pi that sends an update every minute to mqtt stating the charge time slots and also wether the current minute is in cheap rate mode or not. I then use the MQTT client in homey.
Wow, impressive lateral thinking!
I got a Homey Pro to avoid having to fiddle with workarounds, Raspberry Pi, etc⌠but first impressions is itâs still far from plug 'n play.
Maybe itâs possible to retreive data with homeyscript.
Can someone try this, or explain how I get a temporary API key (not a customer here)?
const myAPIKey = 'abc123' // change into personal API key here
const url = 'https://api.octopus.energy/v1/accounts/';
const res = await fetch(url, {
headers : {
'x-api-key': myAPIKey
}
});
if (!res.ok) {
throw new Error(res.status);
return false;
}
const json = await res.json();
//const value = json.value;
log (json);
return true;
I am currently out of the country until 1st September. I will be able to help then as I got chat GPT to do that but for me too. lol I have a copy of the code
Hi, Iâm an Octopus customer, and have an API key, but Iâm not a coder and am completely new to Homey Pro. Iâve installed the Homeyscript app, but not sure what to do next.
Hi,
You can copy the code 1:1 by hitting the copy symbol:
Goto Homeyscript (https://my.homey.app/scripts)
Hit âNew Homeyscriptâ, and paste the code in the top right screen, it should look similar to this:
Change the example API key in line 1 to your personal key;
Hit the blue Save button, and then the green âRunâ button next to it;
Now the results should show at the bottom screen, below âConsoleâ
As you can see, I got error 401 returned, which means âunauthorisedâ (invalid API key)
I hope this gets you going.
Thanks for your very detailed instructions⌠but unfortunately, I get exactly the same 401 error.
The URL https://api.octopus.energy/v1/accounts/ requires login credentials. So, do these need to be added to the script? (Sorry, I donât really understand .json)
Yes, youâll have to change the example API key abc123
in Line 1, into the API key you received:
Does that make any sense?
You can obtain your API key from your online dashboard (https://octopus.energy/dashboard/new/accounts/personal-details/api-access)
And, youâre welcome!
I am the same person that told you I have an API key.
I did use my own key, and when I got an error, I regenerated the key and tried again.
Sorry about that, forgot / did not read back the topic.
If you are sure your API key is valid, I donât know what to test next.
One thing what might error: the single quotes ' '
are needed around your API key in line 1, donât leave them out.
Make sure theyâre not fancy quotes (cursive). Only straight quotes are valid.
Yes I double-checked, the syntax is correct. Iâve sent you a message.