Open jkomaha opened 7 years ago
Having an issue with the state_cmd - everything is returned as state ON with the following configuration. pgrep returns the PID if the process is found, or nothing if not.
{"name": "Dim Red", "on_cmd" : "~/.homebridge/dim_red", "off_cmd" : "~/.homebridge/leds_off", "state_cmd" : "ps aux | pgrep -f dim_red" }, {"name": "Bright Red", "on_cmd" : "~/.homebridge/bright_red", "off_cmd" : "~/.homebridge/leds_off", "state_cmd" : "ps aux | pgrep -f bright_red" }, {"name": "Dim Blue", "on_cmd" : "~/.homebridge/dim_blue", "off_cmd" : "~/.homebridge/leds_off", "state_cmd" : "ps aux | pgrep -f dim_blue" }, {"name" : "Bright Blue", "on_cmd" : "~/.homebridge/bright_blue", "off_cmd" : "~/.homebridge/leds_off", "state_cmd" : "ps aux | pgrep -f bright_blue" }
Try this: "state_cmd": "if pgrep -i 'dim_red'; then exit 0; fi; exit 1"
"state_cmd": "if pgrep -i 'dim_red'; then exit 0; fi; exit 1"
Having an issue with the state_cmd - everything is returned as state ON with the following configuration. pgrep returns the PID if the process is found, or nothing if not.