I can´t get this to work in the latest version of HA. There was a message that switch was depreciated and i tried to fix that but also lost the initial config. how should i do this.
Thank you tom, your changes saved the day. In studio code server it looks if your code is wrong (patternWarning on all switch. services) but it does seem to work. So editing in the visual studio code plugin was a source of my confusion.
If you want to keep things a bit more tidy in configuration.yaml you could add template: !include template.yaml to it, create a file in the same folder called template.yaml and paste your templates into that. Remove template from line 1 and add your code to template.yaml:
- switch:
- name: Garage Door 1
state: "{{ is_state_attr('binary_sensor.garage_1_input', 'sensor_state', 'off') }}"
and so on