Command line switch + tplink

Any assistance appreciated

My config works today with

switch:
platform: command_line
switches:
family_room_tv:
command_on: “/home/homeassistant/.homeassistant/scripts/lightwaverf.sh R1D1 ON”
command_off: “/home/homeassistant/.homeassistant/scripts/lightwaverf.sh R1D1 OFF”
friendly_name: Family Room TV
family_room_led:
command_on: “/home/homeassistant/.homeassistant/scripts/lightwaverf.sh R1D2 ON”
command_off: “/home/homeassistant/.homeassistant/scripts/lightwaverf.sh R1D2 OFF”
friendly_name: Family Room LED Strip

I want to add tplink switches to this however cant get the syntax correct. Assumed it would be something like

switch:

  • platform: tplink
    host: 192.168.0.69
    name: switch1
  • platform: tplink
    host: 192.168.0.66
    name: switch2
    platform: command_line
    switches:
    family_room_tv:
    command_on: “/home/homeassistant/.homeassistant/scripts/lightwaverf.sh R1D1 ON”
    command_off: “/home/homeassistant/.homeassistant/scripts/lightwaverf.sh R1D1 OFF”
    friendly_name: Family Room TV
    family_room_led:
    command_on: “/home/homeassistant/.homeassistant/scripts/lightwaverf.sh R1D2 ON”
    command_off: “/home/homeassistant/.homeassistant/scripts/lightwaverf.sh R1D2 OFF”
    friendly_name: Family Room LED Strip

Log shows

2017-11-24 13:12:12 ERROR (SyncWorker_0) [homeassistant.util.yaml] while parsing a block collection
in “/home/homeassistant/.homeassistant/configuration.yaml”, line 452, column 3
expected , but found ‘?’
in “/home/homeassistant/.homeassistant/configuration.yaml”, line 458, column 3
2017-11-24 13:12:12 ERROR (MainThread) [homeassistant.bootstrap] Error loading /home/homeassistant/.homeassistant/configuration.yaml: while parsing a block collection
in “/home/homeassistant/.homeassistant/configuration.yaml”, line 452, column 3
expected , but found ‘?’
in “/home/homeassistant/.homeassistant/configuration.yaml”, line 458, column 3

Try this

- platform: tplink
  host: 192.168.0.69
  name: switch1

- platform: tplink
  host: 192.168.0.66
  name: switch2

- platform: command_line
  switches:
    family_room_tv:
      command_on: "/home/homeassistant/.homeassistant/scripts/lightwaverf.sh R1D1 ON"
      command_off: "/home/homeassistant/.homeassistant/scripts/lightwaverf.sh R1D1 OFF"
      friendly_name: Family Room TV
    family_room_led:
      command_on: "/home/homeassistant/.homeassistant/scripts/lightwaverf.sh R1D2 ON"
      command_off: "/home/homeassistant/.homeassistant/scripts/lightwaverf.sh R1D2 OFF"
      friendly_name: Family Room LED Strip

Also, it's easier to read/troubleshoot if when posting your code on here you select it and click the 'Preformatted text' (code) button :slightly_smiling_face:

thanks, i tried but fails with the following

2017-11-24 14:36:09 ERROR (SyncWorker_0) [homeassistant.util.yaml] mapping values are not allowed here
  in "/home/homeassistant/.homeassistant/configuration.yaml", line 453, column 9
2017-11-24 14:36:09 ERROR (MainThread) [homeassistant.bootstrap] Error loading /home/homeassistant/.homeassistant/configuration.yaml: mapping values are not allowed here
  in "/home/homeassistant/.homeassistant/configuration.yaml", line 453, column 9

it works if you don’t use name: within the configuration

- platform: tplink
  host: 192.168.0.66

home assistant seems to get the name i assigned to the switch when i set it up in the app.

Strange, name works in mine.

I guess you could use ‘friendly_name: Whatever’ under customize instead.