Combining solar forecast and energy prices for automation

Hi!

I have no idea how to pull of this automation. So please If you have any idea, it is very welcome!

Currently I use energy prices (hour by hour) to only switch on my warm water tank on low price hours. That automation works fine.

What I know how to do:

  • Switch tank on when energy price is low
  • Switch tank on when solar forecast is above 3kW/h

What I would like to do:

  • Hours above 3kW/h solar forecast, switch on water tank
  • On low price, only switch on tank if there are less than 2 hours of solar forecast above 3kW/h on that day