Switch switching switches

I’m stuck with a likely very easy problem. I have a command line switch to switch my computer on or off. The command_on is a “normal” command line, but now i want to change the command_off from a different command line to the using the core_rpc_shutdown addon. How can i make it so that both are one switch called rechner?

- platform: command_line
    switches:
      rechner:
        friendly_name: 'Rechner'
        command_on: 'some command line'
        command_off:  ?

that’s what i want to do as command_off:

turn_off:
  service: hassio.addon_stdin
  data:
    addon: core_rpc_shutdown
    input: Desktop

I think i need a template switch here, but i’m probably not seeing the forest for the trees.

Here it is:

Make a shell_command with your ‘some command line’ and you can call it as a service in the template switch

1 Like

Thanks, shell_command was the missing ingredient. Here’s the working template in case someone want the same:

  - platform: template
    switches:
      rechner:
        value_template: "{{ is_state('device_tracker.desktop', 'not_home') }}"
        turn_on:
          service: shell_command.wake_up_pc
        turn_off:
          service: hassio.addon_stdin
          data:
            addon: core_rpc_shutdown
            input: desktop