Solar battery charging on cheap electric


#1

Ive just had a solar and battery install done in the UK and at this time of year ill be relying on using cheap electric over night to top the battery up to supplement the solar during the day.
Im looking to automate this but tying myself in knots on how to go about it.
i can get cheap electric between 00:30 and 07:30
i have a solar predictor that gives me a guide to how much the solar will produce.

this is what i currently use and it works quite well

what i would like todo is look at the current state of charge (soc) in the battery and adjust the time to start charging ie. so @ 2:30 solar prediction is less that 2kwh and battery SOC is @ 50% so start charging @04:30 rather than what i have at the moment it would start charging @02:30.
my thoughts are IF statements but its going to get very big so wondering if theres a better way?