luisiam / homebridge-cmdswitch2

CMD Plugin for HomeBridge (API 2.0): https://github.com/nfarina/homebridge
Apache License 2.0
176 stars 29 forks source link

How to turn off Linux machine? #67

Open mixtly87 opened 3 years ago

mixtly87 commented 3 years ago

Let's say I have a configuration like:

{
    "name": "Linux Computer",
    "on_cmd": "wakeonlan xx:xx:xx:xx:xx:xx",
    "off_cmd": "sshpass -p mypassword ssh -tt root@192.168.0.4 '/sbin/poweroff'",
    "state_cmd": "ping -c 2 -W 1 192.168.0.4 | grep -i '2 received'"
}

I'm aware of security risks here; but shutting down doesn't work since I updated Homebridge to be used as a system service and with Homebridge web server page.

Before it used to work fine but now I used to get message 'Pseudo-terminal will not be allocated because stdin is not a terminal.' so I added -tt parameters and that didn't help.

There is a single error message in the homebridge log now:

[9/17/2020, 14:28:10] [CMD Switch] Failed to turn off Linux Computer
[9/17/2020, 14:28:10] [CMD Switch] 

I'm not sure what else to try or if there is completely different approach to try? Did anyone face similar issues?

I'm running Homebridge on RPI, model 3.