Octopus Agile api use with Hubitat

That's great news Rob, I hope that your move to Octopus Energy goes smoothly.

You will certainly need to have your Smart Meter/s installed and working before you actively trial the use of their API with Hubitat. But there are things that you might be able to investigate beforehand in rediness for that. Their https://tech.octopus.energy/ might also be useful for that, depending on how techy you are.

Do let me know how it goes for you.

I'm fairly techy, been a programmer for about 40 years :slight_smile:

Thanks for that link.

I do have a smart meter already, but I think it's only SMETS1 (and not necessarily the right type)

Finally made a limited start on this, it looks as though given the account number and the API key I can create all the meters as devices automatically. Once that's done I'll see what can be done about retrieving the half-hourly prices (although at the moment they mostly seem to be at, or just below the capped rate).

2 Likes

That's great news Rob. Do let us know how you get on.

You are correct about the half hourly rate presently, but I suspect the 35p cap will be raised (unfortunatley) which will make the tariff much more attractive again, particulalry since there will still be part of some days when the rate is likley to be negative.

Well done Rob.

Very interested in this as im heading down the solar and batteries route.

Are u looking at export as well?

Not sure what the feature set is going to be yet, more than happy to listen to suggestions.

If as a minimum it would be great to be able to trigger events based on the prevailling Octopus time of use rate. e.g. switch on a plug if the half hourly rate is less than #p/kWh, and/or switch off when it is above #p/kWh.

It would be useful to be able to monitor the Octopus outgoing rates too, but I'm less sure what practical uses that could be put to.

1 Like

Out going would work if you have a battery, if it ever goes higher than the import empty battery to the grid.

Not massively important but would be useful.

That would be useful for someone who has built their own battery and/or solar installation, and could be very helpful in those circumstances.

My own battery comes with cloud services that optimises storage, import, and export. It uses a solar API and the Octopus API to automate that, in conjunction with an algorythm which learns patterns of consumption in the home.

What the smart battery stoarge isn't able to do however, is to see or manage how the overall domestic load is built up (my car charger comes with its own cloud services that uses the Octopus API to manage BEV charging).

What would be really useful then would be a means of allowing Hubitat to manage home device use to optimise for the time of use electricity price.

Just thought I should keep you up to date with the development.

I currently have a working main app where you enter your account number and API key, with a child app for each import electricity meter and a corresponding device which can fetch the prices (currently that's a device command rather than on a schedule). The child app and corresponding device are created automatically when you click the update button.

The child app allows you to specify named price bands, the ultimate goal of which will be to inform you in some fashion about the current (and possibly upcoming) price band the meter is in.

There will probably be a special notification for plunge pricing (which we hit in my area for the first time last Saturday since I've been with Octopus).

It's been slow going as my time is fairly limited at present, but it's ticking along.

In its current state it's not suitable for any automations I'm afraid.

I'd like to add consumption data at some point, in order to predict what a bill will look like, but that's a way off at the moment.

3 Likes

This is really great Rob, well done.

I wish that I had your skills, or even enough knowedge to understand the process more fully. My hope had been that the app could be used to trigger events based on price, eg if price is below X then run revice Y, or (better still) run device Y for X hours when the price is lowest in the coming 24 hours.

Is it resaonable to hope that this might be possible?

John

Yes, that's the sort of thing I'm aiming for.

Although I'd probably suggest that something like Rule Machine should be used for that.

I may make the bands into switches that get turned on when a price band comes into play. Possibly with a setting to only do it if it's more than some configurable number of half-hour slots. I suppose if a lower price band becomes current then it should leave the switch for the initial band turned on.

It's been a bit tricky doing anything with it the last few days since prices have been stuck at or near the cap for a while.

Hi there, just resurrecting this. Did anything ever come of it? Thanks!

I've got this working in principle, although i'm not using the API. Instead, I'm using the method shared by @LibraSun (thanks very much for this) in this post here:

as for how this is relevant to agile octopus, I've used IFTTT to populate the data daily into google sheets (a free applet so a pro membership is not required), some sheets functions to manipulate it into a format that hubitat can extract, and then created a rule using the guidance above that runs at 2330 each night to extract the data into a series of hub variables according to the half hourly values. It seems to work nicely for the first few variables i've entered (i've not put all 48 in yet); the only thing I need to confirm is if the sheets data will update in the background without me opening it. I think it should, but haven't confirmed.

In theory I can probably also write some google sheets formulae that calculate the cheapest 1 hour, 2 hour, 3 hour window and then export that time as a further variable to use in Hubitat, in order to trigger automations at certain times.

2 Likes

I'm still only part way there - the problem is that when I find the time to work on it the rates seem to get stuck at 35p/kWh which makes it tricky to perform any tests.

I can see about putting the current code up on github though in case anyone wants to take it over.

1 Like

Have finally managed to book in a smart three phase electricity meter for January. Coupled with Octopus Agile, it will be a game changer for heating parts of our house overnight using IR panels, rather than our gas-powered central heating system.

With that in mind, did anyone ever manage to get anything into a state that works and are willing to share the know-how?

I'm using my workaround quite successfully, noted earlier in this thread - using IFTTT to populate the data into google sheets then scraping that information into variables in hubitat. It works just fine, and allows me to do some manipulation of the data before putting it into hubitat - such as calculating the start time of the the cheapest 1 hr / 2hr 3hr windows each day and having that as a variable.

It's far from elegant, took an age to write the rules (48 nested if statements), and the rule breaks when I update my system from 2.3.5 to 2.3.6....but it'll do me until someone here manages to do something better!

1 Like

Ok great, thanks for the assistance with that. I can't sign up for the IFTTT feed until I'm officially on the Agile tariff, which I can only do once the smart meter is installed, I understand the concept though, so just the small matter of trying to get it all working. Will let you know how I get on in 4-6 weeks or so!

Hi @c.j.winter just wondering if the IFTTT integration is still working for you?

Get my smart meter on Tuesday and keen to get some ducks in a row ahead of then. Have been doing some messing around with getting Google Sheets data into RM and now have the broad principles sorted in my mind.

However, I can't sign up for the IFTTT integration until I'm on the Agile tariff and can't get on the Agile tariff until I have the smart meter, so not totally sure what format everything will be in.

A bit of reading around threw up this, should I be worried that actually I'm not going to be able to do anything when the new meter is installed?

https://www.reddit.com/r/OctopusEnergy/comments/18r75zw/ifttt_octopus_applets_dont_work_anymore_anyone

Afternoon, My automation (linking Octopus to google sheets) hasn't run for the past couple of weeks either, I'm afraid. So, my unit rates are not updating in Hubitat. I hadn't noticed until you pointed this out, as I don't really use the automation for much at the moment. sorry!

1 Like