So there is a calculation for what time the sun is at a particular angle in the sky which will be relative to your area and factors in the time of year etc. You could use that as it will give you a very specific to your area mathematical answer to when you should close your shades. This is a good start. If you mix that with a light sensor and set minimums that will get you the rest of the way there (no sense run blocking lightning a cloudy day.) You can just use a light sensor but it will be more erratic if you don't correct for weather and seasonal light levels.
The rest is personal to how sensitive to light changes and seasonal settings you apply to it.
As far as the physical control goes - there are several commercial devices available as well as diy solutions involving motors and 3d printing on YouTube.