This seems so simple, yet even following many threads still stuck on automation to accomplish:
1, Turn on switch1 at 06:00:00
2. Turn off switch1 at 23:00:00
3. Activate on home assistant restart.
That’s not a suitable test procedure. All it does is execute the automation’s actions, it doesn’t exercise any of the automation’s three triggers.
The action in this automation references a variable named cmd that is only defined when one of the three triggers is triggered. Therefore cmd is undefined and the template produces an invalid service call.
If you want to test this automation right now, restart Home Assistant (because that’s what the automation’s third trigger monitors) then check the automation’s trace.
Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.