ON/OFF Loop via a rule

That’s all a bit jumbled. Using { } with if/else is a good idea. You need to finish creating your timer block ] before continuing with an if/else from outside of the timer block.

Relevant discussion