Switch working, but Error shown "LEGACY_SYNTAX"

Hello everyone, can anyone tell me what is wrong with my switch? I have used this exact switch since years and it is still working, but for some reason, studio code server shows that there is something wrong. I can’t figure it out.

switch:
  - platform: template
    switches:
      franks_pc:
        unique_id: franks_pc
        friendly_name: "Franks PC"
        value_template: "{{ is_state('switch.rechner_frank_schalter', 'on') }}"
        turn_on:
          - service: switch.turn_on
            entity_id: switch.homeoffice
          - delay: 3
          - service: switch.turn_on
            entity_id: switch.rechner_frank_schalter
        turn_off:
          - service: switch.turn_off
            entity_id: switch.homeoffice
          - service: switch.turn_off
            entity_id: switch.rechner_frank_schalter

What it does is to turn on my Monitors, and after 3 seconds, my Desktop PC. If I don’t do it that way the breaker trips.

Thanks everyone!

Best regards,
Frank.

- action: switch.turn_on will remove the warning. service: has been depreciated but will continue to work regardless. I changed all of mine because I can’t stand to see the warning.

Edit to add links to release notes:
2024.8.0: Services become actions
2024.10.0: Top level automation and script changes

1 Like

Thank you a lot, this was easier then expected!

Glad I could help.