Getting generic command line switch to work - custom identifier

Hi there :slight_smile:

I try to get multiple command line switches to work. One turns on motion and the other one should control the power of the USB-hub…

  switch:
  - platform: command_line
    name: Camera
    switches:
      camera:
        friendly_name: Kamera
        command_on: sudo service motion start
        command_off: sudo service motion stop
      USB:
        friendly_name: USB
        command_on: sudo ./hub-ctrl -h 0 -P 2 -p 1
        command_off: sudo ./hub-ctrl -h 0 -P 2 -p 0

So it says that the identifier “USB” is not valid. Where can I find a list of all valid identifiers? How can I build my own? How can I connect a cmd sensor which monitors the status of the service “motion” so the switch shows the current camera status correctly after a restart? Thank you guys for the help!!

I think they just have to be lowercase and not match any others. Try usb

1 Like

Hey thanks a lot! That was exactly the problem… wow feeling very dump :smiley:
I connect a cmd sensor with a switch via the switch template?