AlexGustafsson / homebridge-wol

A Wake on Lan plugin for Homebridge
MIT License
301 stars 30 forks source link

Can't get pc to shut down #170

Closed fender7083 closed 3 years ago

fender7083 commented 3 years ago

I have spent weeks trying to get my pc to shut down. Can not figure out the issue. Here is my error code: NetworkDevice "fende" (192.168.1.15) went from status "Online" to "Shutting Down" [9/14/2021, 3:36:01 AM] [fende] Attempting to shut down "fende" (192.168.1.15) using "net" [9/14/2021, 3:36:01 AM] [fende] An error occured while trying to shut down "fende" (192.168.1.15): Error: Command failed: net rpc shutdown --ipaddress 192.168.1.15 --user fende%1965 The syntax of this command is:

NET [ ACCOUNTS | COMPUTER | CONFIG | CONTINUE | FILE | GROUP | HELP | HELPMSG | LOCALGROUP | PAUSE | SESSION | SHARE | START | STATISTICS | STOP | TIME | USE | USER | VIEW ]

at ChildProcess.exithandler (child_process.js:390:12)
at ChildProcess.emit (events.js:400:28)
at maybeClose (internal/child_process.js:1055:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5) {

killed: false, code: 1, signal: null, cmd: 'net rpc shutdown --ipaddress 192.168.1.15 --user fende%1965', stdout: '', stderr: 'The syntax of this command is:\r\n' + '\r\n' + 'NET\r\n' + ' [ ACCOUNTS | COMPUTER | CONFIG | CONTINUE | FILE | GROUP | HELP |\r\n' + ' HELPMSG | LOCALGROUP | PAUSE | SESSION | SHARE | START |\r\n' + ' STATISTICS | STOP | TIME | USE | USER | VIEW ]\r\n' } [9/14/2021, 3:36:01 AM] [fende] Waiting for shutdown grace time (15000ms) for "fende" (192.168.1.15) [9/14/2021, 3:36:16 AM] [fende] NetworkDevice "fende" (192.168.1.15) went from status "Shutting Down" to "Online"

my json config is as follows:

{ "bridge": { "name": "Homebridge 3042", "username": "0E:BE:E7:88:30:42", "port": 51616, "pin": "400-47-047" }, "accessories": [ { "accessory": "WinPC", "name": "fende", "http_method": "GET", "on_url": "wol://70:85:c2:07:70:1c", "off_url": "http://192.168.1.15:51616/?action=System.Shutdown", "status_url": "http://192.168.1.15:51616/", "sendimmediately": "yes", "poll_status_interval": "60", "username": "fork", "password": "1965", "powerstateOnError": "0", "powerstateOnConnect": "1" }, { "accessory": "PC", "name": "fende", "http_method": "GET", "on_url": "wol://70:85:c2:07:70:1c", "off_url": "http://192.168.1.15:7878/?action=System.Shutdown", "status_url": "http://192.168.1.15:7878/", "sendimmediately": "yes", "poll_status_interval": "60", "username": "fende", "password": "", "powerstateOnError": "0", "powerstateOnConnect": "1" }, { "name": "fende", "ip": "192.168.1.15", "pingInterval": 2, "pingsToChange": 5, "pingTimeout": 1, "pingCommandTimeout": 0, "mac": "70-85-C2-07-70-1C", "broadcastAddress": "192.168.1.15", "startCommandTimeout": 0, "wakeGraceTime": 45, "wakeCommandTimeout": 0, "shutdownCommand": "net rpc shutdown --ipaddress 192.168.1.15 --user fende%1965", "shutdownGraceTime": 15, "shutdownCommandTimeout": 0, "log": true, "logPinger": false, "debugLog": false, "returnEarly": false, "accessory": "NetworkDevice" }, { "accessory": "NetworkDevice", "name": "Raspberry Pi", "mac": "fd38:d6d5:5b6f:1:b411:a2fe:9863:ea90 fd9d:627e:fb8:3:fb52:6f51:f06e:8fba", "ip": "192.168.1.25", "pingInterval": 45, "wakeGraceTime": 90, "shutdownGraceTime": 15, "shutdownCommand": "sshpass -p 'raspberry' ssh -oStrictHostKeyChecking=no pi@192.168.1.25 sudo shutdown -h now" } ], "platforms": [ { "name": "Config", "port": 8581, "platform": "config" }, { "app_list": true, "devices": [ { "name": "Samung q80t", "ip": "192.168.1.26", "mac": "44:5C:E9:90:95:96", "uuid": "01132feb-82d5-42f4-baf4-a17bbf83e254", "inputs": [ { "type": "app" } ] } ], "platform": "SamsungTizen" } ], "disabledPlugins": [ "homebridge-winpc-mg", "homebridge-brpc", "homebridge-winpc" ] }

Any help would be amazing. I don't know much code and tried posting on reddit for assistance as well. Thanks!

fender7083 commented 3 years ago

I didn't install homebridge on my RBPi. I installed on there and can now shut down pc. In the wiki, the start/turning on command isn't given so I'm unable to turn on PC over LAN. I presume it will be a variation of net rpc shutdown --ipaddress 192.168.1.15 --user fork%1965, or similar with SSH Thanks!