Command Line Switch Trouble

I need some help. I’m trying to setup a command line switch, but it doesn’t seem to like my command_state

Here’s the code I have:

  - platform: command_line
    scan_interval: 30
    switches:
      ambibox:
        command_on: >-
          python /home/pi/ambion.py
        command_off: >-
          python /home/pi/ambioff.py
        command_state: >-
          echo 'getstatus' | nc IP PORT | grep -Po 'status:on'
        value_template: >-
          {{ value == 'status:on' }}

But I keep getting this error: 2017-05-07 10:51:24 ERROR (Thread-6) [homeassistant.components.switch.command_line] Command failed: echo 'getstatus' | nc IP PORT | grep -Po 'status:on'

Even though it’s successful when I run it through my command line by itself

Hi @kflinderman, here are several tips for ‘command_line’ problems.