Pete (and others),
https://github.com/neilkplugins/Octopus_Energy-indigo-plugin/releases/tag/0.2.17-alpha is a test version that includes my interpretation of the functionality you require, but will need testing. Here is how it works :-
- I have created a new device type "Charge Sensor" that can be triggered to "On" when the rate is "cheapest" to deliver the number of hours charging you require. It can also be overidden if the rate exceeds a configurable threshold. (e.g. It may be the one of the cheaper periods in the day or night, but it is still too high to warrant charging a Home Battery or Electric Vehicle)
The device configuration includes
Agile Rate Device - This is the tariff device that the "Charge Sensor" is associated with. In most cases this will be the Octopus Agile Device you already have designed, but it is possible to monitor rates and trigger for other locations (a home and an office for example)
How many hours of charging needed - Select the number of hours you would like to charge your load. In this initial version it will work across two periods "Night" which is from Midnight until 7:00am and "Day" which is 9:00 until 15:00. This is largely abritrary but the cheapest periods usually fall during these times.
Night / Day Charging - it will calculate the best periods for the charge time required in the "Night" or "Day" Windows described above.
Do not charge above (in Pence) - creates a rate threshold that will prevent the sensor turning "on" if the rate is above the defined figure. If you leave at the default of 35 then this will never happen as this is the maximum rate, but you can lower so that you do not pay to charge your powerwall if the rate is not economical even if in relative terms it is cheap for the day
You should be able to trigger from this as a normal Indigo sensor device.
I also provide device states that show "Preferred_Periods" that are the number of periods when the sensor will "fire" sorted from cheapest to most expense up until the number of hours you have requested. "Preferred_Rates" are the associated rates for the periods, again sorted cheapest to most expense.
It has had limited testing, so use at your own risk but it should not break anything else and feel free to give feedback and requests.
Future Version Plans
- I will add an action to allow the "No_Charge_Above" rate to be varied on demand, rather than as a fixed device configuration
- I will add a similar action to vary the number of hours needed to charge
- I will bring the hours after the evening peak into scope, this requires a little more work as currently this crosses the day boundary so I will need to make my logic a little more sophisticated. In most cases the best rates will be between 00:00 and 7:00 anyway I can easily extend the 7:00 limitation.
Thanks,
Neil