I have solar panels and a heat pump, which heats water in a hot water tank. I use the Octopus Agile tariff, which means that my energy price varies every half hour.
There is a very good Octopus integration for Home Assistant, which I have set up. One of its features is a sensor which turns on when the electricity import price is the lowest for a fixed period in the next 24 hours. This can be used to turn on the heat pump’s water heating function in the best 2:30h slot in any given day.
There is also an action in this integration that allows the price weightings to be adjusted (“register_rate_weightings”). This allows for each half hour’s price to be adjusted by a factor depending on some data.
What I want to do is use a solar forecast to register these rate weightings: for every half hour in which the forecast says that the solar panels will be producing more than 2kW of power, I want the effective price to be halved for the purposes of calculating the optimum time. This is because, if I am producing more than 2kW, the water heating is likely to be run entirely from the solar panels, and the price that I will be paying will not be the import price, but rather the opportunity cost of not exporting energy from the solar panels in that period. Typically export prices are about half import prices. Unfortuantely, the Octopus integration does not allow using the export prices directly in only some hours for detecting a target rate.
However, I am struggling to find a way to make this work. In particular, I am struggling to find any reliable way of extracting half hourly (or even hourly) solar forecast data. I have Forecast.solar set up, and can see the forecast, hour by hour, in the energy tab, which is, although not perfectly accurate, accurate enough for me to use for this purpose.
The actual sensors available from Forecast.Solar, however, do not allow for hourly power production forecasts, even though the Forecast.Solar API provides these data.
I have spent many hours looking at topics dealing with this issue, such as this discussion here, but I cannot make any of the code snippets given in those topics work, either because some knowledge that I do not have (and cannot find because there is no clue as to what sort of information is missing) is implicitly assumed by whoever posted them, because there is an error in the code, or because the code is no longer compatible with the current version of Home Assistant: I know not which.
For example, in this post, there is a code snippet for creating a “rest” sensor. Adding that to configuarion.yaml does not work and produces errors. No clue is given in the post about where to add this code snippet. There is a second code snippet given, but it is unclear how this relates to the first nor to which file or files that this snippet should be added and what, if any, further steps are necessary to allow this code to be executed at the appropraite time(s). Adding it immediately after the first produces syntax errors.
I have not yet got to the stage of working out how to make the data work with the Octopus integration as I have not got as far as exposing the data yet.
Does anyone have any idea about where even to begin with this? This seems as though it is far more difficult than it should be.