OpenEVSE / ESP8266_WiFi_v2.x

ESP8266 WiFi for OpenEVSE Version 2.x
https://openevse.openenergymonitor.org
76 stars 46 forks source link

Octopus Energy Integration #175

Open glynhudson opened 6 years ago

glynhudson commented 6 years ago

Octopus Energy have recently launched an electricity tariff in the UK with dynamic pricing Octapus Agile Tariff which included 'Plunge' pricing which occurs when energy prices go negative when there is too much power! At these times a user would get paid to use electricity.

Octopus Energy have a developer API: https://developer.octopus.energy/docs/api/

It would be great to be able to integrate with the API to set the OpenEVSE to charge at the cheapest time of day and start charging when a 'Plunge' event occurs.

beaylott commented 6 years ago

The relevant API call is: https://api.octopus.energy/v1/products/{product_code}/electricity-tariffs/E-1R-AGILE-18-02-21-{gsp_id}/standard-unit-rates/

Where product_code for the Agile tariff is AGILE-18-02-21 (I dont think this will change but worth bearing in mind it is a parameter) and where gsp_id corresponds to the GSP Group ID as found in the MPAN ( https://en.wikipedia.org/wiki/Meter_Point_Administration_Number#Metered_Supply_Point). Note that some DNO's are associated with more than one GSP group.

So for a customer in GSP Group D (Merseyside and Northern Wales) the URL would be:

https://api.octopus.energy/v1/products/AGILE-18-02-21/electricity-tariffs/E-1R-AGILE-18-02-21-D/standard-unit-rates/

This should return a JSON with the unit prices for each 30 minute period.

NickJenkey commented 5 years ago

Really helpful thanks, now to incorporate it into the script to control the battery storage...

glynhudson commented 5 years ago

Octopus also make available an API to obtain your history consumption:

See: https://octopus.energy/dashboard/developer/

e.g

curl -u "API KEY:" https://api.octopus.energy/v1/electricity-meter-points/1300012035212/meters/18P6806936/consumption/

[{"consumption":0.087,"interval_start":"2019-03-27T23:30:00Z","interval_end":"2019-03-28T00:00:00Z"},{"consumption":0.089,"interval_start":"2019-03-27T23:00:00Z","interval_end":"2019-03-27T23:30:00Z"},{"consumption":0.423,"interval_start":"2019-03-27T22:30:00Z","interval_end":"2019-03-27T23:00:00Z"},{"consumption":1.31,"interval_start":"2019-03-27T22:00:00Z","interval_end":"2019-03-27T22:30:00Z"},{"consumption":0.117,"interval_start":"2019-03-27T21:30:00Z","interval_end":"2019-03-27T22:00:00Z"},{"consumption":0.111,"interval_start":"2019-03