Binary sensor use with motion

I’m using a command line binary switch to control whether a camera is active with Motion.
it either sends pause or start.
I have managed to get an ack back using tail -f and grep to load the response line to a file

the example I’m trying to use is this one

command_line:
  - binary_sensor:
      command: '/bin/systemctl is-active [email protected]'
      payload_on: "active"
      payload_off: "inactive"

will this work

command_line:
  - binary_sensor:
      command: 'cat /home/odroid/test.txt | grep "/detection/" '
      payload_on: "start"
      payload_off: "pause"

I would also need someway of deleting the file contents after the sensor has read the payload or
would it be better to erase the contents of the file with the command on the command line binary switch

lounge_cam:
        command_on: 'lwp-request http://localhost:7770/101/detection/start'
        command_off: 'lwp-request http://localhost:7770/101/detection/pause' 

sorta

command_on: ' < delete file contents> && 'lwp-request http://localhost:7770,,,ect'

some guidance would be really appreciated
thanks

I have found a simpler way , in a browser, firefox etc

  ip_address:7770/101/detection/status

returns either ACTIVE or PAUSE
from the CLI

lwp-request http://localhost:7770/101/detection/status

returns either ACTIVE or PAUSE,
but in configuration .yaml

command_line:
  - binary_sensor:
      name: Cam_status
      command: 'lwp-request http://localhost:7770/101/detection/status'
      payload_on: "ACTIVE"
      payload_off: "PAUSE"

this returns in lovelace "unknown "
yet lwp-request works on the switch

Now working , the payload requires everything that is returned

command_line:
  - binary_sensor:
      name: Cam_status
      command: 'lwp-request http://localhost:7770/101/detection/status'
      payload_on: "Camera 101 Detection status ACTIVE"
      payload_off: "Camera 101 Detection status PAUSE"