This will take a good deal of time to analyze. but some first thoughts:
Any time I see a rule that doesn’t fit on the screen, particularly if it is not working, I look for ways to move the logic out of the rule to simplify it. It is easier to debug that way and easier to understand.
Whenever I see that degree of nesting (five nested ifs right off the bat) alarm bells go off. I would create a new proxy Item to determine if it is appropriate to do the shading and move all of those nested ifs into a separate rule. In this rule just check that proxy Item. This will be easier to read and easier to test. Alternatively you could move them into a lambda.
At a high level I would put the sun detected logic in its own rule and create the timer there.
Put the physical button press logic in its own rule and create a different timer there.
You will have to split the interaction between the two between the two rules.
Perhaps this evening when I get home I’ll be able to spend some time on this.