KhaosT / homebridge-amazondash

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

Problem reading Config.json #7

Open crosspjc opened 8 years ago

crosspjc commented 8 years ago

I had homebridge running successfully with nest and Sonos. I then added homebridge-amazondash. When running with elevated privileges I receive the "There was a problem reading your config.json file. Please try pasting your config.json file here to validate it: http://jsonlint.com." Error.

My config.json file is as follows and I have restyled all the quote marks in case there were any format issues.

config.json

{"bridge": { "name": "HomeBridge", "username": "CC:22:3D:E3:CE:30", "port": 51826, "pin": "031-45-154" },

"accessories": [ { "accessory": "Sonos", "name": "Living Room Speakers", "room": "Living Room" }, { "accessory": "Sonos", "name": "Kitchen Speakers", "room": "Kitchen" }, { "accessory": "Sonos", "name": " Bedroom Speakers", "room": "Master Bedroom" } ],

"platforms": [ {

"platform": "Nest", "token" : "Xxxxxxx", "clientId": "xxxxx", "clientSecret": "xxxx", "code": "Xxxxxx",

"username" : "Xxxx", "password" : "xxxxx" }, {

"platform": "AmazonDash", "buttons": [ { "name": "Dash Blue", "mac": "02:0f:b5:ab:73:c7" } ]}

] }

I have used json lint that reports no errors.

Any ideas as this is driving me nuts?!?!!?

Will711990 commented 7 years ago

Hi,

I have the same issue that Crosspjc, but I think it's not a script error ! To use a Dash Button, Homebridge has to always listening your network, and you need to be SuperUser.

If you write $raspberry@pi : homebridge System will execute Homebridge with config.json file in /.homebridge/

But if you write : $raspberry@pi : sudo homebridge (to listening the network as asked by homebridge) System will execute Homebridge with the config.json file in /root/.homebridge/

The problem is when I open /root/.homebridge/config.json, it's empty, and if I try to write something in, I can't save it ! I think Homebridge can't read config.json file in /root, so we have a message that there is a mistake in this file.

I'm unsure of this, but it could be an explaination ! So if you have a solution to write in /root, and to have authorization to read in, I'll could try ! :)

thank you !!