steve228uk / homebridge-dash

A quick and dirty Homebridge plugin for Amazon Dash
MIT License
13 stars 4 forks source link

Sudo homebridge doesn't work #3

Open Will711990 opened 7 years ago

Will711990 commented 7 years ago

Hi,

I need your help !! I wanna configure my Dash Button... so I installed homebridge-dash. When I right Homebridge, I work nicely but I can't use my Dash Button, because I need of user's rights.

And when I write sudo homebridge it tells me there is a mistake in my config.json file. But there isn't because it works without sudo !!!

I'm on PRi 3 and I can't find solution and I don't understand... Do you have a solution because I don't understand : Run Homebridge with elevated privileges...

thank you !

` There was a problem reading your config.json file. [2/15/2017, 9:06:13 PM] Please try pasting your config.json file here to validate it: http://jsonlint.com [2/15/2017, 9:06:13 PM] /usr/local/lib/node_modules/homebridge/lib/server.js:197 throw err; ^

Error: EISDIR: illegal operation on a directory, read at Error (native) at Object.fs.readSync (fs.js:603:19) at Object.fs.readFileSync (fs.js:438:24) at Server._loadConfig (/usr/local/lib/node_modules/homebridge/lib/server.js:191:28) at new Server (/usr/local/lib/node_modules/homebridge/lib/server.js:52:38) at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:26:16) at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22) at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32)`

vsidlu commented 7 years ago

I strugled with same problem. Homebridge worked perfectly with other plugins like - wemo - ifttt. After adding plugin homebridge-dash its suddenly hangs on. I realized that there is problem with privileges. The thing that helped me is -

edit file homebridge.service

sudo nano /etc/systemd/system/homebridge.service

Change User=pi to User=root

[Unit] Description=Node.js HomeKit Server After=syslog.target

[Service] Type=simple User=pi EnvironmentFile=/etc/default/homebridge ExecStart=/usr/lib/node_modules/homebridge/bin/homebridge $HOMEBRIDGE_OPTS RestartSec=10 KillMode=process

[Install] WantedBy=multi-user.target

I hope it helps you!