KhaosT / homebridge-amazondash

Amazon Dash Button plugin for Homebridge
58 stars 14 forks source link

Sudo Homebridge doesn't work #14

Open Will711990 opened 7 years ago

Will711990 commented 7 years ago

Hi,

I need your help, I installed Homebridge and updated my config.json file. After, I write : homebridge All my devices are detected and it's nice (so there isn't mistake in my file)

Now I wanna use my DashButton, but to use homebridge-amazondash service, I need to write sudo homebridge. At this moment, it tells me there is a mistake in my config.json (but I know it's wrong because it works with homebridge. It tells me too it can't read the file, so I supposed that I've got a user's right problems...

But I don't know how to do... so I can't use my DashButtons... Do you have a solution please ?

Thank you

PS : I'm running HomeBridge on a RPi 3

`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)`

Fienberber commented 7 years ago

I have the exact same problem Dit you find a solution ?

vsidlu commented 7 years ago

I strugled with same problem. Homebridge worked perfectly with other plugins like - wemo - ifttt. After adding plugin homebridge-amazondash 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!

LazzR1 commented 7 years ago

I'm having the same issue. but I don't have this file: /etc/systemd/system/homebridge.service

vsidlu commented 7 years ago

I used this instruction to set up Homebride = https://docs.google.com/document/d/1k2u9Id4O4rO0v-7j8-3Yb1JuDZGAVS8ltS4cu-71U9w/edit

Fienberber commented 7 years ago

I managed to make it work by simply edit the config.json in the root file in /root/.homebridge. My two config.json are the same I don't know if you can only set up the dash button in the root. But it works for me.