Git Product home page Git Product logo

homebridge-http-advanced's Introduction

homebridge-http-advanced

Supports https devices on the HomeBridge Platform and provides a real time polling for getting the "On" and brightness level characteristics to Homekit. Includes Switch, Light, Door, Smoke and Motion sensor polling.

Installation

  1. Install homebridge using: npm install -g homebridge
  2. Install this plugin by cloning this repo.
  3. Update your configuration file. See sample-config.json in this repository for a sample.

Configuration

The configuration for this plugin is the same as homebridge-http but includes an additional method to read the power state of the device and the brightness level. Specify the status_url in your config.json that returns the status of the device as an integer (0 = off, 1 = on). Specify the brightnesslvl_url to return the current brighness level as an integer.

Switch handling and brightness handling support 3 methods, yes for polling on app load, realtime for constant polling or no polling

Configuration sample:

"accessories": [ 
   {
   	"accessory": "Http",
   	"name": "Alfresco Lamp",
   	"switchHandling": "realtime",
   	"http_method": "GET",
   	"on_url":      "http://localhost/controller/1700/ON",
   	"off_url":     "http://localhost/controller/1700/OFF",
   	"status_url":  "http://localhost/status/100059",
   	"service": "Light",
   	"brightnessHandling": "yes",
   	"brightness_url":     "http://localhost/controller/1707/%b",
   	"brightnesslvl_url":  "http://localhost/status/100054",
   	"sendimmediately": "",
   	"username" : "",
   	"password" : ""					    
      } 
   ]

Services

Each service shows up as a specific HomeKit device.

Service URL Type Data format Description
Lux brightnesslvl_url JSON: { "lightlevel": 94.00 } Ambient light sensor
Occupancy status_url Integer: 1 or 0 Occupancy Sensor
Motion status_url Integer: 1 or 0 Motion Sensor
Light status_url Integer: 1 or 0 Switch status for the light
Light brightnesslvl_url Integer: 0 to 100 Current brightness percentage for the light

homebridge-http-advanced's People

Contributors

adrum avatar novagl avatar oultond avatar rudders avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

homebridge-http-advanced's Issues

Not working on MOTION

Maybe i'm dumb but can't make it work when changing "light" to "Motion"

get this:

TypeError: Cannot read property '0' of undefined
at Server._createAccessory (/usr/lib/node_modules/homebridge/lib/server.js:380:17)
at Server._loadAccessories (/usr/lib/node_modules/homebridge/lib/server.js:266:26)
at Server.run (/usr/lib/node_modules/homebridge/lib/server.js:81:38)
at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:40:10)
at Object. (/usr/lib/node_modules/homebridge/bin/homebridge:17:22)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)

Status error

I get this error sometimes. Can you (or someone) correct this. Like if its can't get the status, wait X seconds and than try again, or something.

[9/19/2017, 9:50:50 PM] [led] HTTP get power function failed: socket hang up
/usr/lib/node_modules/homebridge-http/index.js:60
callback(error);
^

ReferenceError: callback is not defined
at /usr/lib/node_modules/homebridge-http/index.js:60:19
at Request._callback (/usr/lib/node_modules/homebridge-http/index.js:160:4)
at self.callback (/usr/lib/node_modules/homebridge-http/node_modules/request/request.js:188:22)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at Request.onRequestError (/usr/lib/node_modules/homebridge-http/node_modules/request/request.js:884:8)
at emitOne (events.js:96:13)
at ClientRequest.emit (events.js:188:7)
at Socket.socketOnEnd (_http_client.js:345:9)
at emitNone (events.js:91:20)
at Socket.emit (events.js:185:7)

modifying script to pull CurrentTemperature

@NovaGL I qas looking at the code in index.js, as I've been looking for a branch that could be modified to pull temperature from an HTTP device, and this is so far the closest I've come.

If I were to branch, and duplicate the "getBrightness" function (line 234) into a getCurrentTemperature function, this is probably where I'd parse out the temperature from my HTTP string.

on Line 248, you have the function var level = parseInt(responseBody); does that responseBody expect a response of only a value of the lighting percentage?

How could I change this to parse a larger response, and find a line with a substring?

I'm not particularly familiar with the language, unfortunately :(

parsing error when trying to poll status

I apologize but I am working at the outer ends of my comfort zone.

Overview:
I am using an Arduino Wifi Uno to handle requests to open and close an actuator. I have it working so that the status 1 or 0 outputs to a URL as a standard HTML page. When I use that URL as my status URL it constantly fails, though if I visit the page in the browser I get a very clear 1 or 0. Should I be formatting my response differently from the around? I can structure it however needed.

Here is the response from the ardunio as viewed from the browser.

0

Cannot install http-advanced

Hi,

i got this Message while installing:

npm ERR! code ENOVERSIONS
npm ERR! No valid versions available for homebridge-http-advanced

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-06-20T11_52_27_332Z-debug.log

I used this Command for installing:
npm install homebridge-http-advanced

Can somebody help me?

Error after install

I get this error after installing it:

[10/29/2016, 3:40:45 PM] ====================
[10/29/2016, 3:40:45 PM] ERROR LOADING PLUGIN homebridge-http-advanced:
[10/29/2016, 3:40:45 PM] Error: Cannot find module 'request'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/usr/lib/node_modules/homebridge-http-advanced/index.js:2:15)
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 Module.require (module.js:353:17)
at require (internal/module.js:12:17)
[10/29/2016, 3:40:45 PM] ====================

what is the problem here?

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.