Open DJay-X opened 7 years ago
You can use bash script to parse the html and look for specific words.
Hi guys,
can someone please tell how execution for state_cmd works?
I can see the if I cat /some/file
and file is empty, I still get true
Is the only option to get false - to have some text in stderr?
I think if you have some script that returns 1 and call it, the result will be considered false
you are right. Exit code == 0 - is true. Any other is false
Hi and thanks for your work and this plugin. I hope not to bother with this but I'm a bit lost with state_cmd. I want to use my Robot Vacuum Cleaner with cmdswitch2 and hope you can help how to get it to work correct and also knowing the state. Does this look right?
"platforms": [{ "platform": "cmdSwitch2", "name": "CMD Switch", "switches": [{ "name" : "HomBot", "on_cmd": "http://xxx.xxx.xxx.xx:6260/json.cgi?%7b%22COMMAND%22:%22CLEAN_START%22%7d", "off_cmd": "http://xxx.xxx.xxx.xx:6260/json.cgi?%7b%22COMMAND%22:%22HOMING%22%7d", "state_cmd": "http://xxx.xxx.xxx.xx:6260/status.html" },
The status is in the first line. status.html named Robot-state: This state can be "CHARGING","STANDBY","PAUSE" when off and WORKING","BACKMOVING_INIT","HOMING" when on.
Thanks in advance for your help.