Network relay state command line switch

hi i have a network relay switch and i have managed to get it to turn on and off via a switch slider but i would like home assistant to be able to know when it has been switched on via other means.

so far i have this in my configuration.yaml file


  • platform: command_line
    scan_interval: 10
    command_on: “curl -X GET htt p://admin:[email protected]/relay.cgi?relayon1=on”
    command_off: “curl -X GET htt p://admin:[email protected]/relay.cgi?relayoff1=off”
    command_state: “curl -X GET ht tp://admin:[email protected]/state.cgi”
    value_template: ‘{{value[67]==“0”}}’

and this is the return i get from web browser


any ideas whats going wrong? also when i switch via ui the relay stays on but the slider goes back to off?

thanks guys

Please format you code so others can confirm its indenting is correct. Otherwise, as it appears one can only guess … and my guess is the indenting is incorrect.

To format your code:

  • Select your code and use the </> icon.
  • Alternately, enter three back-quotes ``` on a separate line before your code and another three on a separate line after your code.