homebridge-cmdswitch2 icon indicating copy to clipboard operation
homebridge-cmdswitch2 copied to clipboard

can't run off command within service

Open mreassassin opened this issue 4 years ago • 4 comments

I have a switch setup with this as the off command:

"off_cmd": "/home/pi/venv/bin/xbox-poweroff --address 192.168.1.35 --liveid FXXXXXXXXXXXXXXX"

this works fine if I run it from a terminal in PuTTy. if I put it in the off_cmd line on cmdswitch2 it fails. do I need to put it in a virtual environment (source venv/bin/activate) first? how do I make this work?

I used to run Homebridge straight from PuTTy, but i got tired of manually having to launch it if it crashed. now I set hb-service up and i'm running into all kinds of problems. this is the only one I can't seem to figure out.

i figured out how to make the 'on' command work by giving the full path. that didn't work with the off command.

any help appreciated!

` ``
{ "name": "TEST", "on_cmd": "python /home/pi/xbox-remote-power/xbox-remote-power.py -a 192.168.1.35 -i FXXXXXXXXXXXXXXX", "off_cmd": "/home/pi/venv/bin/xbox-poweroff --address 192.168.1.35 --liveid FXXXXXXXXXXXXXXX8", "state_cmd": "ping -c 2 -W 1 192.168.1.35 | grep -i '2 received'", "timeout": 200, "manufacturer": "Microsoft", "model": "XBOX ONE", "serial": "XXXXXXXXXXX" }


mreassassin avatar Jul 10 '20 02:07 mreassassin

I got a similar problem. I want to run a c++ code. Works fine on the terminal of the machine. But when I execute it through homebridge-cmdswitch2 nothing happens.

CTeipen avatar Dec 30 '20 08:12 CTeipen

Did you try the full path?

mreassassin avatar Dec 30 '20 17:12 mreassassin

It was a problem with the permissions. I could fix it.

CTeipen avatar Jan 01 '21 14:01 CTeipen

It was a problem with the permissions. I could fix it.

I also guess this is the permission problem. may I know how to fix it?

yenan1001 avatar Dec 15 '21 10:12 yenan1001