ngardiner / TWCManager

Control power delivered by a Tesla Wall Charger using two wires screwed into its RS-485 terminals.
The Unlicense
130 stars 55 forks source link

Adjust charge rate based on real-time pricing #115

Open ngardiner opened 4 years ago

ngardiner commented 4 years ago

Based off of Amber: https://www.amberelectric.com.au/pricing

The idea is that instead of increasing/decreasing based on green energy generation, the charge rate could be increased/decreased based on proximity to a target maximum real-time wholesale price. This is more a generic concept rather than an actual implementation as amber do not yet have an exposed API, but a module template to do this would be useful as I am sure there are similar platforms globally.

AndySchroder commented 4 years ago

How frequently do you expect to adjust the charge rate?

ngardiner commented 4 years ago

This particular provider changes the rate based on the prevailing wholesale rate for a given region on an hourly basis, although I could certainly foresee cases where the rate would be more real time than that, so it might be a matter of leaving polling interval to the individual interface

MikeBishop commented 4 years ago

IIRC, I saw a thread on Reddit where the provider gave pricing in 5-minute increments, published an hour in advance.

ngardiner commented 4 years ago

What I am thinking as a starting point would be to add a module class (Pricing) which then obtains real-time pricing data from an API interface. Generally I would expect the two key values of interest would be Import and Export prices, with a cent per kWh rate for each. Since this involves currencies there is every chance it could be much more complex than I am envisaging, but the idea would be:

Two examples of where this could be useful:

In some instances, the import rate has the capability to rise into the dollars per kWh range where grid demand is beyond supply. In such a case there could be a cut-off where we just stop communicating with all slaves to ensure no charging occurs during the excessive pricing period.

mattclar commented 4 years ago

I use amber and adjust my charging based on pricing... They also helpfully give a green-yellow-red rating on the current price vs upcoming prices. I can show you how I query their api

ngardiner commented 4 years ago

Hi @mattclar - I'd certainly be interested in knowing more about interacting with the Amber API. It might make for a good framework as more providers offer flexible rates and real time APIs

mattclar commented 4 years ago

@ngardiner honestly it's really just a hack that I've reverse engineered! Hopefully they are working on a real API

mattiasclaesson commented 3 years ago

This is something that would be nice to get in place!

My provider tibber has this api to query for past, todays, tomorrows prices. Each hour has a dedicated price. https://developer.tibber.com/docs/overview They buy and sell at this same price.

There is a integration for home-assistant also https://www.home-assistant.io/integrations/tibber/

ngardiner commented 3 years ago

I'll take a look, @mattiasclaesson. Thanks for the API reference!