Octopus Agile Integration with OpenEVSE?

Hi,

I have just signed up for Octopus Agile and I’m now trying to optimise my energy usage!

Has anyone done any kind of Octopus Agile integration with OpenEVSE?
I suspect it probably makes sense to do some kind of separate script and the send commands to OpenEVSE (rather than adding support for it in the firmware).

But I am slightly surprised to not find someone has written something similar already? Maybe because other tariffs are better value for EVs?

I was planning to use create a Claim to do this:

Can I make up my own Client Id for this purpose?
Or should I use EvseClient_Vendor_Unregistered?

Thanks,

nick.

If you use home assistant the bottlecapdave octopus integration is very good for pulling down agile data.

With that you can either just send a command when the price drops below a limit, or you can create tracker rates where it will find the X cheapest half hour slots between certain hours. I do this to pull the cheapest hours between 11-6am.

The OpenEVSE integration doesn’t look like it has options to control the charging? But I’m sure you could send the commands in a manual fashion as it supports is commands/web requests etc with a bit of tinkering.

1 Like

Thanks Ben. No, I don’t currently use Home Assistant but useful to know that it exists.

The Home Assistant Integration can control the charge:

It can also be done via the HTTP or MQT API, RAPI has now been deprecated.

2 Likes

Claims is the correct API to use, or you can use manual override API.

Yes, I think this will work.

Ah I was looking at the docs OpenEVSE - Home Assistant here.

There’s normally always another integration that does what you want :grin:

That’s the old integration, it doesn’t work with the latest WiFi version. We’ve been trying to get HA to update, but they seem to prefer keeping integrations separate from the core now. We link to the new integration from the OpenEVSE WiFi docs page.

I have just moved back to Agile. Do we have a new user guide on how to set OpenEVSE to work with Octopus Agile? I used to use the demand shaper.

I am currently just using a fixed schedule, that charges my car at night, when it is most likely to be cheap.

I started writing some scripts for working with the Octopus Agile tariff. But I can’t decide on the strategy to use for charging my car:

  1. Charge whenever price is below X p/kwh (con: may never switch on some days?)
  2. Charge whenever price is in lower price quartile
  3. Choose the cheapest X hours of night to charge

I also wonder how much money I would actually save by adding this complexity.

For Option 2: I successfully managed to split prices into four groups, based on data from previous 30 days:

  • :green_square: Low
  • :yellow_square: Medium-Low
  • :orange_square: Medium-High
  • :red_square: High
2024-05-14:
🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟨🟨🟩🟧🟥🟧🟧🟧🟥🟧🟧🟧🟧🟧🟨🟩🟩🟩🟩🟩🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟧🟨🟨

So it wouldn’t be hard to turn the charger on, whenever there is a ‘green’ 30 minute period.

For Option 3, in order to choose the cheapest period of time to charge for, you kind of need to know the State of Charge of the battery. I did make some progress with getting the State Of Change of my Peugeot iOn via a Bluetooth ELM327 dongle. But that needs some further work too.

1 Like

I have some Node Red code (now running on Home Assistant, but used to be on my openenergymonitor pi.) It uses an algorithm to determine a target SoC based on price. In the evening it works out what the cheapest combination of half-hours will deliver the target SoC based on how much the car charges (about 5% for mine) in each half hour period. So if prices aren’t very low, then it will charge to a lower SoC, if prices are very low it will charge to higher SoC.

I’m lucky in that there is a NodeRed integration to read the Hyundai/Kia API, so I can use that to work out what SoC the car is at. In practice though, I only read it when the car is plugged in and then when my estimate of SoC has increased by more than 10% as it drains the 12v battery if you keep reading it - I found that out the hard way!

Rachel

2 Likes

Hi Rachel

Would you be willing to share your flow?

Paul

Would also be interesting to take into account solar production tomorrow, I have 2 BMW i3 but 1 charger at the moment I am manually turning them on and off with a timer.

Do you have any details on how to setup your github?

I’m happy to share, but it needs a bit of tidying up and my internet has fallen over as of yesterday. I think it’s a cable problem in the street somewhere, so it may take a while to fix, but once I have set up some sort of connectivity, I’ll have a go.

I could really do with fixing the demandshaper module as well. I have also recently moved back to agile and my current scheduling approach is a bit cumbersome, looking up the best times in one of the agile apps and then setting the timer on the EmonEVSE.

The device interface for the openevse/emonevse is here demandshaper/devices/openevse.php at master · emoncms/demandshaper · GitHub, but Im not sure what changes are required to get this working with the WiFi V4.x as that wasnt a piece of development I was involved in, I bet it’s probably quite simple…

Coding is not my cuppa tea. But having a look it failing to load the octopus data. as all of the time periods are set to 12p

I have found the bit demandshaper/forecasts/octopusagile.php at master · emoncms/demandshaper · GitHub but no idea how to fix it.

// 3. Map forecast to request start, end and interval
$profile = array();
for ($time=$params->start; $time<$params->end; $time+=$params->interval) {
$forecast_time = floor($time / $forecast_interval) * $forecast_interval;
if (isset($octopus[$forecast_time])) {
$price = $octopus[$forecast_time];
} else if (isset($octopus[$forecast_time-(243600)])) {
$price = $octopus[$forecast_time-(24
3600)];
} else {
$price = 12.0;
}
$profile = $price;
}

Hello @Pukka

I’ve got this working again here with my EmonEVSE, provisionally in a branch called ‘openevse_wifi_v4’ GitHub - emoncms/demandshaper at openevse_wifi_v4. This uses the new HTTP api available with the latest openevse wifi firmware and fixes pulling in the Agile profiles too.

Using the http api introduces the requirement to find the openevse IP address which is something that I haven’t automated or provided a mechanism for yet. just hardcoded in the development branch here if you did want to try it and modify,see line 14 here demandshaper/devices/openevse.php at openevse_wifi_v4 · emoncms/demandshaper · GitHub

Hi @TrystanLea

Thanks for looking at this :smiley: I know this might sound stupid. in emoncms under admin components I cannot see how to change the branch I get stable and master. I feel like I am missing something any pointers?

So this works by dynamically updating the timer/schedule on the main OpenEVSE board?
And when the local clock on OpenEVSE reaches the pre-calculated time, it switches on automatically?
I quite like that approach but is there any risk of wearing out the EEPROM (I presume that is where it is stored) through the regular automatic updates? I guess one update per day isn’t a lot.

Would you be able to SSH into your Pi and run the following?:

cd /opt/emoncms/modules/demandshaper/
git fetch
git pull
git checkout openevse_wifi_v4
sudo systemctl restart demandshaper.service

As far as I can see and @jeremypoulter can correct me if I’m wrong, the firmware uses LittleFS, a comment here suggests that it implements wear levelling How to do the correct count of cycles to write/erase flash cycles? · micropython · Discussion #12009 · GitHub how effective that is I’m not sure.

1 per day without wear levelling would give ~27 years minimum…
I must admit I haven’t dived into this one on the openevse and it would be good to know the lifetime impact of regular updates like this