Giter Club home page Giter Club logo

Comments (10)

AlexGustafsson avatar AlexGustafsson commented on June 14, 2024

Hello Elroy,

Yes, Ubuntu will do a fine job of running homebridge. I've used it since I first started using homebridge. There are even commercial NASs supporting homebridge.

I've updated the readme file to reflect the actual features of the plugin. The last text that you are referring to had not been updated since it was first written and therefore outdated. Thank you for noticing!

In short, homebridge-wol can turn on and off devices as advertised in the title. However, to support shutdown a bit more, platform specific, setup has to be done. Homebridge-wol simply runs a shell command that you specify when it's told to shut down. You can use a ssh command to shut down as shown in the example config.

Note that there is an updated and revised version in the works. You can follow the progress here #13 and here #14.

from homebridge-wol.

eterpstra avatar eterpstra commented on June 14, 2024

Hi Alex,

Sorry for the late reply but i was quite busy with work. A few days ago I installed my new Ubuntu server-server ;)

Everything is working fine now. The next step is to install youre WOL plugin.

  1. Installed the plugin.
  2. Added the following code to my config file:

[code]
{
"bridge": {
"name": "Homebridge",
"username": "CC:21:3E:E4:DE:33",
"port": 51826,
"pin": "031-45-154"
},
"description": "Configuration file for (e)xtended Domoticz platform.",
"platforms": [{
"platform": "eDomoticz",
"name": "eDomoticz",
"server": "127.0.0.1",
"port": "8080",
"ssl": 0,
"roomid": 0,
"mqtt": 0
}],

"accessories": [{
	"accessory": "Computer",
	"name": "Server",
	"mac": "XX:XX:XX:XX:XX:XX",
	"ip": "192.168.0.17",
	"pingInterval": 45,
	"wakeGraceTime": 90,
	"shutdownGraceTime": 15,
	"shutdownCommand": "ssh 192.168.0.17 sudo shutdown -h now"
}]

}
[/code]

The config file is valid.
But when I restart homebridge, it fails:

homebridge.service - HomeBridge Service
Loaded: loaded (/lib/systemd/system/homebridge.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2017-03-03 22:54:23 CET; 1s ago
Process: 2758 ExecStart=/usr/local/lib/node_modules/homebridge/bin/homebridge (code=exited, status=1/FAILURE)
Main PID: 2758 (code=exited, status=1/FAILURE)

Mar 03 22:54:23 ubuntu-server homebridge[2758]: [3/3/2017, 10:54:23 PM] Loaded config.json with 1 accessories and 1 platforms.
Mar 03 22:54:23 ubuntu-server homebridge[2758]: [3/3/2017, 10:54:23 PM] ---
Mar 03 22:54:23 ubuntu-server homebridge[2758]: [3/3/2017, 10:54:23 PM] Loading 1 platforms...
Mar 03 22:54:23 ubuntu-server homebridge[2758]: [3/3/2017, 10:54:23 PM] [eDomoticz] Initializing eDomoticz platform...
Mar 03 22:54:23 ubuntu-server homebridge[2758]: [3/3/2017, 10:54:23 PM] Loading 1 accessories...
Mar 03 22:54:23 ubuntu-server homebridge[2758]: [3/3/2017, 10:54:23 PM] [Server] Initializing Computer accessory...
Mar 03 22:54:23 ubuntu-server homebridge[2758]: /usr/local/lib/node_modules/homebridge-wol/node_modules/raw-socket/index.js:47
Mar 03 22:54:23 ubuntu-server systemd[1]: homebridge.service: Main process exited, code=exited, status=1/FAILURE
Mar 03 22:54:23 ubuntu-server systemd[1]: homebridge.service: Unit entered failed state.
Mar 03 22:54:23 ubuntu-server systemd[1]: homebridge.service: Failed with result 'exit-code'.
``

Any Idea what this could be?

THe strange thing is when I run homebridge in debug mode (homebridge -D) the config is loaded correctly...

from homebridge-wol.

AlexGustafsson avatar AlexGustafsson commented on June 14, 2024

Right now the plugin requires sudo permissions to be able to ping devices correctly. Can you try to start homebridge with sudo rights?

from homebridge-wol.

eterpstra avatar eterpstra commented on June 14, 2024

Alex,

Yes I am running homebridge with sudo rights.

But if keeps failing with:

Mar 05 10:50:36 ubuntu-server homebridge[1981]: /usr/local/lib/node_modules/homebridge-wol/node_modules/raw-socket/index.js:47
Mar 05 10:50:36 ubuntu-server homebridge[1981]:         this.wrap = new raw.SocketWrap (

I can run sudo homebridge -D . and it is loaded correctly.

When I delete the config settings in accessory, its working fine.

from homebridge-wol.

AlexGustafsson avatar AlexGustafsson commented on June 14, 2024

It seems to be an issue with the pinging package that I haven't seen before. Could you try the new, rewritten version of homebridge-wol? It uses a native implementation of pinging.

It's available in a separate branch. For more information, see issue #13

from homebridge-wol.

eterpstra avatar eterpstra commented on June 14, 2024

Oke thanks..

I switches to the beta version and remove the master version first (npm remove -g homebridge-wol)

But when I run sudo service homebridge status, the accessory WOL is not loaded. is this normal?

I ran the following commands:

npm remove -g homebridge-wol
git clone https://github.com/AlexGustafsson/homebridge-wol.git
cd homebridge-wol
git checkout beta
npm link
sudo service homebridge restart

Now homebridge started correctly, but the accessory is missing (I guess)

from homebridge-wol.

eterpstra avatar eterpstra commented on June 14, 2024

Hi Alex,

I am a step further now. I installed the beta again and run homebridge with sudo homebridge

The plugin is loaded correctly now. When I grab my Ipad and want to shutdown the server, I can see Ubuntu still wants to have a password to shutdown the server. Once I have entered the password in the terminal, the computer/server shuts down.

Is there a way to add the password within the script ?

from homebridge-wol.

AlexGustafsson avatar AlexGustafsson commented on June 14, 2024

Great! Did you change anything else or did it work by simply reinstalling the beta?

In short, no, nor is it a planned feature. The way homebridge-wol manages the shutdown command is that it simply launches it like if you would have typed the command yourself in the terminal. So whatever works for you in the terminal by hand will most likely work as a shutdown command. Note that the commands are run as the same user as homebridge. So if you've created a separate user to run homebridge, that user needs permission to shutdown the server.

All in all this issue is related to Linux itself. Here's an answer over on askubuntu that I've used before:

http://askubuntu.com/questions/168879/shutdown-from-terminal-without-entering-password

Also, please notify me if you find any problems using the beta.

from homebridge-wol.

eterpstra avatar eterpstra commented on June 14, 2024

Hi,

Thanks for the answer,

But I want to let homebridge shutdown my server if I want to.. And the reason why I want to use this plugin is I dont want to shut down it manually but simply use a button on my iPad and set it to ''OFF"

When i click on the OFF button the command is send to my machine but i still need to ender a password in the terminal for processing the action. Is there a way to avoid this?

I have read the acticle that you suggested, but it didnt helped me (I still have to enter my root / sudo password each time in the terimal)

from homebridge-wol.

AlexGustafsson avatar AlexGustafsson commented on June 14, 2024

Since we want homebridge-wol to be able to run any command of your choice, we never interfere with the command or how it runs. The plugin simply runs the command as is as the user who runs homebridge. Therefore this issue is not directly related to how the package works, rather how Linux works.

You need to make sure that the user who runs homebridge (could be "homebridge", your user or even "root") has the privilege to shutdown your server without entering the password, hence the link I gave you. If you did not find the link helpful, try to google "how to shutdown without password ubuntu" or something similar.

from homebridge-wol.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.