rudders / homebridge-http

HTTP Plugin for Homebridge
Apache License 2.0
178 stars 110 forks source link

New to Homebridge using http plugin #51

Closed Kerat5 closed 7 years ago

Kerat5 commented 7 years ago

Hey guys, I am pretty new to home automation. Currently, I use a Raspberry Pi 3 running Raspbian Jessie lite. my home automation system is homeseer. I am using MONO to stand the application up on Linux. I have enabled JSON in homeseer and allowed local subnet devices to not require login.

I saw some pretty cool features that would allow me to control my HA system devices "accessories" from Homebridge hosted on a Linux server.

I used the following outlines to assist me in getting homebridge installed and setup.
https://github.com/nfarina/homebridge/wiki/Running-HomeBridge-on-a-Raspberry-Pi https://github.com/nfarina/homebridge/blob/master/README.md http://blog.wia.io/installing-node-js-on-a-raspberry-pi-3 https://gist.github.com/johannrichard/0ad0de1feb6adb9eb61a/

I had some trouble attempting to get a separate service account setup for the auto-start so it is currently running as root. From what i can tell I am having a permissions issues and haven't determined what level of permissions are required for the service account to run.

my config.json file is: { "bridge": { "name": "Homebridge", "username": "", "port": 51826, "pin": "" },

"description": "Castle7 homebridge.",

"accessories": [
    {
        "accessory": "http",
        "name": "Lighting Exterior East",
        "on_url": "http://192.168.1.131/JSON?request=controldevicebyvalue&ref=25&value=255",
        "off_url": "http://192.168.1.131/JSON?request=controldevicebyvalue&ref=25&value=0",
        "http_method": "GET"
    }
]

}

I was able to get my homebridge to run from systemctl one time and was able to turn on and off the single accessory i added. I then stopped homebridge from systemctl and attempted to add a second accessory. when attempting to run homebridge from the systemctl command and then running a status check i receive the following:

sudo systemctl status homebridge œ homebridge.service - Node.js HomeKit Server Loaded: loaded (/etc/systemd/system/homebridge.service; enabled) Active: activating (auto-restart) (Result: exit-code) since Tue 2016-10-18 22:51:48 MDT; 2s ago Process: 8272 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE) Main PID: 8272 (code=exited, status=1/FAILURE)

Oct 18 22:51:48 HOMEADMIN homebridge[8272]: at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:24:7) Oct 18 22:51:48 HOMEADMIN homebridge[8272]: at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22) Oct 18 22:51:48 HOMEADMIN systemd[1]: homebridge.service: main process exited, code=exited, status=1/FAILURE Oct 18 22:51:48 HOMEADMIN systemd[1]: Unit homebridge.service entered failed state.

in order to get more information I attempted to run homebridge from shell directly and received the following: /usr/local/bin/homebridge -U /var/homebridge * WARNING * The program 'node' uses the Apple Bonjour compatibility layer of Avahi. * WARNING * Please fix your application to use the native API of Avahi! * WARNING * For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=node * WARNING * The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi. * WARNING * Please fix your application to use the native API of Avahi! * WARNING * For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=node&f=DNSServiceRegister [10/18/2016, 10:40:06 PM] Loaded plugin: homebridge-http [10/18/2016, 10:40:06 PM] Registering accessory 'homebridge-http.Http' [10/18/2016, 10:40:06 PM] --- [10/18/2016, 10:40:06 PM] Loaded config.json with 1 accessories and 0 platforms. [10/18/2016, 10:40:06 PM] --- [10/18/2016, 10:40:06 PM] Loading 1 accessories... /usr/local/lib/node_modules/homebridge/lib/api.js:60 throw new Error("The requested accessory '" + name + "' was not registered by any plugin."); ^

Error: The requested accessory 'http' was not registered by any plugin. at API.accessory (/usr/local/lib/node_modules/homebridge/lib/api.js:60:13) at Server._loadAccessories (/usr/local/lib/node_modules/homebridge/lib/server.js:251:42) at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:78:38) at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:40:10) 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) at Function.Module._load (module.js:300:12) at Function.Module.runMain (module.js:441:10)

I then attempted to check my JSON file by using "http://jsonlint.com/#" and cleaned up the syntax. still i receive the same error as above.

I then checked the hithub for users with similar issues, and found that some users noted that i may need to remove excess white space. i did that and still received the above error.

Lastly I attempted to call the http plugin in the platforms section of the json file: ],

"platforms": [
    {
        "platform" : "Http",
        "name" : "Http"
    }
]

}

with the same net effect, except before the error happens i get a loading 1 plugin instead of 1 error.

my system specs are: Linux 4.4.21-v7+ #911 SMP Thu Sep 15 14:22:38 BST 2016 armv7l GNU/Linux

PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)" NAME="Raspbian GNU/Linux" VERSION_ID="8" VERSION="8 (jessie)" ID=raspbian ID_LIKE=debian HOME_URL="http://www.raspbian.org/" SUPPORT_URL="http://www.raspbian.org/RaspbianForums" BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

gcc version 4.9.2 (Raspbian 4.9.2-10)

I looked online and while I see that many others have trouble with named plugins I don't see anyone specifically with a problem with the "http" plugin. I also checked to see if there may have been a recent upgrade and it looks like this version has been unchanged in 8 months. any help would be greatly appreciated.

Kerat5 commented 7 years ago

I found my problem, the accessory call is case sensitive.
"accessories": [{ "accessory": "Http", "name": "Lighting Exterior East", "on_url": "http://192.168.1.131/JSON?request=controldevicebyvalue&ref=25&value=255", "off_url": "http://192.168.1.131/JSON?request=controldevicebyvalue&ref=25&value=0", "http_method": "GET"