I did something like this. I buy my electricity at wholesale prices, and the supplier has an API with price predictions, so I used node-red to compare insolation forecasts, and price forecasts to work out what time-blocks to run the pool pump (when solar high, or price low, or cheapest forecast times to achieve a minimum number of hours per day).
Not quite the same as home automation, but there's a home-made renewable energy system community too: