Closed Hidduh closed 6 years ago
Are you running homebridge on a Windows computer?
The shutdown command is called on the same computer that hosts the server, which may change the way the command handles. I’m assuming you’re running homebridge on a unix-like server which usually doesn’t share the same or lack the shutdown command you’re trying to issue.
I'm running Homebridge on a Raspberry Pi.
I'm aware that I can't issue unix-like commands to Windows, however since I send the command to an IP on my local network with the correct windows params (/s /f /t /m \
Managed to solve this by using net rpc to shutdown Windows from Raspbian.. derp.
Thanks for the assistance.
Great! That was what I was getting at with my somewhat unclear mention of differences in shutdown commands. Do you think that the documentation could be improved to make this more clear?
Right now it may not be obvious where the command is excecuted. Perhaps a shutdown example for Windows should be added to the configuration example already available. Any thoughts?
It'd be great if there was some sort of mention of how users running some sort of Linux distro can send (shutdown)commands to a Windows machine. Could definitely save them some time before having to resort to Google for information.
As an example, I used the following command which I send through Homebridge on my Raspberry Pi to my desktop PC running Windows 10. Be aware that the samba-common package is required in order to achieve this. (install via apt-get)
{
"accessory": "NetworkDevice",
"name": "Desktop",
"mac": "<mac>",
"ip": "192.168.178.10",
"shutdownCommand": "net rpc shutdown --ipaddress 192.168.178.10 --user <username>%<password>
}
Note: if you're on Windows 10 and you're signing in with a Microsoft account, sign in using your local username instead of your Microsoft ID (e-mail).
Great! I more or less copied your command and note and they're now available beside the other examples and notes in the readme. Thank you for your help.
Backstory
I'm trying to send a shutdownCommand to Windows to remotely shut down my computer through the Home app on my iPhone/Watch, however it returns an error when the shutdown command is sent by tapping the 'off' button in my Home app. Should be possible to get this working or am I doing something completely wrong?
Environment
Configuration
My configuration looks like this:
Log
When I follow these steps:
DEBUG=* homebridge
I get the following log:
shutdown.exe with /:
Notes
Typing out 'shutdown /s /f /t 30 /m \192.168.178.10' in cmd.exe on Windows works perfectly fine, so there's nothing wrong with the syntax.