Aircon solar control

So I finally have air con control in HA. I have real time solar gen, total house usage, and also this

A day may be like this

Yellow is the generation and purple is the usage.

overnight is the ac usage Generally it’s around 2kw.

I want To set an automation that will turn off the ac when the solar drops in the afternoon. When it’s a sunny day I can do a simple automation for when gen < 2kw.

But what do I do on cloudy or rainy days?