Is there a better way?

hi there,

is there a better way of configuration? I would like to reduce the redundancy of the switch commands:

 switch:
      - platform: command_line
        switches:
          sofa_licht:
            command_on: irsend SEND_ONCE ledleuchte KEY_POWER
            command_off: irsend SEND_ONCE ledleuchte KEY_POWER2
          kueche_licht:
            command_on: '/home/pi/raspberry-remote/send 01101 1 1'
            command_off: '/home/pi/raspberry-remote/send 01101 1 0'
          bett_licht:
            command_on: '/home/pi/raspberry-remote/send 01101 2 1'
            command_off: '/home/pi/raspberry-remote/send 01101 2 0'
          schaf_licht:
            command_on: '/home/pi/raspberry-remote/send 01101 3 1'
            command_off: '/home/pi/raspberry-remote/send 01101 3 0'

    shell_command:
      sofa_on: irsend SEND_ONCE ledleuchte KEY_POWER
      sofa_off: irsend SEND_ONCE ledleuchte KEY_POWER2
      kueche_on: '/home/pi/raspberry-remote/send 01101 1 1'
      kueche_off: '/home/pi/raspberry-remote/send 01101 1 0'
      bett_on: '/home/pi/raspberry-remote/send 01101 2 1'
      bett_off: '/home/pi/raspberry-remote/send 01101 2 0'
      schaf_on: '/home/pi/raspberry-remote/send 01101 3 1'
      schaf_off: '/home/pi/raspberry-remote/send 01101 3 0'
    automation:
      - alias: "Alles aus wenn abhaue aus"
        initial_state: 'on'
        trigger:
          platform: state
          entity_id: device_tracker.iphonexx
          from: 'home'
          to: 'not_home'
        action:
          - service: media_player.turn_off
          - service: shell_command.sofa_off
          - service: shell_command.kueche_off
          - service: shell_command.bett_off
          - service: shell_command.schaf_off