Esphome template switch restore state not working

I have two template switches with the following configuration.

 - platform: template
   name: "Activate Click"
   id: activateclick
   restore_state: true
   optimistic: yes
 - platform: template
   name: "Full Screen"
   optimistic: yes
   id: fullscreen
   restore_state: yes   

I want them to restore the state after restarting. It was working fine till yesterday but now it is not restoring its state. What could be the problem. I am using Esp01s modules with this.

I have the same problem - did you find a solution? I’ll do a working around defining a number where the last switch state is stored, if no solutiom is possible

I couldn’t find a solution so i shifted to tasmota where the option to restore state worked.

You don’t have a turn_on or turn_off action defined. Therefore the state can not be restored.

I found the solution: Restore_state doesn’t work, even with turn_off /turn_on action. Waht works is “restore_mode: RESTORE_DEFAULT_OFF” - which is same with the GPIO-switches

Thanks for reporting back. I was wondering that, and even checked the template switch documentation before replying. I’ll submit a documentation edit.

perfect, thank you! That will help others a lot

Did you use restore_state: at all?

I’m wondering if it needs both, restore_state and restore_mode.

yes it needs both. without restore_state: true it doesn’t work, I just tested it

Ah damn. I had better remove my edit then.