Giter Site home page Giter Site logo

hap-client's People

Contributors

forty2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

hap-client's Issues

Pairing with Philips Hue bridge throws Bad status: 429 Too Many Requests

Hi,

I want to pair with the Philips Hue bridge (on port 8080) using the example code.

I always get an exception Bad status: 429 Too Many Requests as response to the pair-setup request:

Caught | 2018-01-06 16:48:15.676 | error | by controller[18]: at TCP.onread (net.js:547:20)
-- | -- | -- | --
Caught | 2018-01-06 16:48:15.675 | error | by controller[18]: at Socket.Readable.push (_stream_readable.js:134:10)
Caught | 2018-01-06 16:48:15.675 | error | by controller[18]: at readableAddChunk (_stream_readable.js:187:13)
Caught | 2018-01-06 16:48:15.675 | error | by controller[18]: at emitReadable (_stream_readable.js:426:7)
Caught | 2018-01-06 16:48:15.674 | error | by controller[18]: at emitReadable_ (_stream_readable.js:432:10)
Caught | 2018-01-06 16:48:15.674 | error | by controller[18]: at Socket.emit (events.js:185:7)
Caught | 2018-01-06 16:48:15.674 | error | by controller[18]: at emitNone (events.js:86:13)
Caught | 2018-01-06 16:48:15.674 | error | by controller[18]: at Socket.socket.on (/opt/iobroker/node_modules/iobroker.javascript/node_modules/message-socket/dist/index.js:168:22)
Caught | 2018-01-06 16:48:15.674 | error | by controller[18]: at Array.forEach (native)
Caught | 2018-01-06 16:48:15.673 | error | by controller[18]: at messages.forEach.msg (/opt/iobroker/node_modules/iobroker.javascript/node_modules/message-socket/dist/index.js:175:40)
Caught | 2018-01-06 16:48:15.673 | error | by controller[18]: at Subject.next (/opt/iobroker/node_modules/iobroker.javascript/node_modules/message-socket/dist/index.js:60:25)
Caught | 2018-01-06 16:48:15.673 | error | by controller[18]: at Array.forEach (native)
Caught | 2018-01-06 16:48:15.673 | error | by controller[18]: at _observers.forEach (/opt/iobroker/node_modules/iobroker.javascript/node_modules/message-socket/dist/index.js:63:19)
Caught | 2018-01-06 16:48:15.672 | error | by controller[18]: at TakeUntilSubscriber.Subscriber.next (/opt/iobroker/node_modules/iobroker.javascript/node_modules/rxjs/Subscriber.js:90:18)
Caught | 2018-01-06 16:48:15.672 | error | by controller[18]: at TakeUntilSubscriber.Subscriber._next (/opt/iobroker/node_modules/iobroker.javascript/node_modules/rxjs/Subscriber.js:126:26)
Caught | 2018-01-06 16:48:15.672 | error | by controller[18]: at FilterSubscriber.Subscriber.next (/opt/iobroker/node_modules/iobroker.javascript/node_modules/rxjs/Subscriber.js:90:18)
Caught | 2018-01-06 16:48:15.672 | error | by controller[18]: at FilterSubscriber._next (/opt/iobroker/node_modules/iobroker.javascript/node_modules/rxjs/operators/filter.js:89:30)
Caught | 2018-01-06 16:48:15.672 | error | by controller[18]: at TakeSubscriber.Subscriber.next (/opt/iobroker/node_modules/iobroker.javascript/node_modules/rxjs/Subscriber.js:90:18)
Caught | 2018-01-06 16:48:15.670 | error | by controller[18]: at TakeSubscriber._next (/opt/iobroker/node_modules/iobroker.javascript/node_modules/rxjs/operators/take.js:82:30)
Caught | 2018-01-06 16:48:15.670 | error | by controller[18]: at InnerSubscriber.Subscriber.next (/opt/iobroker/node_modules/iobroker.javascript/node_modules/rxjs/Subscriber.js:90:18)
Caught | 2018-01-06 16:48:15.670 | error | by controller[18]: at InnerSubscriber._next (/opt/iobroker/node_modules/iobroker.javascript/node_modules/rxjs/InnerSubscriber.js:23:21)
Caught | 2018-01-06 16:48:15.670 | error | by controller[18]: at DeferSubscriber.OuterSubscriber.notifyNext (/opt/iobroker/node_modules/iobroker.javascript/node_modules/rxjs/OuterSubscriber.js:19:26)
Caught | 2018-01-06 16:48:15.670 | error | by controller[18]: at ExpandSubscriber.Subscriber.next (/opt/iobroker/node_modules/iobroker.javascript/node_modules/rxjs/Subscriber.js:90:18)
Caught | 2018-01-06 16:48:15.669 | error | by controller[18]: at ExpandSubscriber._next (/opt/iobroker/node_modules/iobroker.javascript/node_modules/rxjs/operators/expand.js:108:59)
Caught | 2018-01-06 16:48:15.669 | error | by controller[18]: at tryCatcher (/opt/iobroker/node_modules/iobroker.javascript/node_modules/rxjs/util/tryCatch.js:6:31)
Caught | 2018-01-06 16:48:15.669 | error | by controller[18]: at /opt/iobroker/node_modules/iobroker.javascript/node_modules/hap-client/dist/HapClient.js:117:47
Caught | 2018-01-06 16:48:15.669 | error | by controller[18]: Error: Bad status: 429 Too Many Requests
Caught | 2018-01-06 16:48:15.669 | error | by controller[17]: Sat, 06 Jan 2018 15:48:15 GMT hap-client:http returning from 99 to 99
Caught | 2018-01-06 16:48:15.668 | error | by controller[16]: Sat, 06 Jan 2018 15:48:15 GMT hap-client:http parsing body
Caught | 2018-01-06 16:48:15.668 | error | by controller[15]: Sat, 06 Jan 2018 15:48:15 GMT hap-client:http finished reading
Caught | 2018-01-06 16:48:15.668 | error | by controller[14]: Sat, 06 Jan 2018 15:48:15 GMT hap-client:http There are 6 bytes left in the buffer
Caught | 2018-01-06 16:48:15.668 | error | by controller[13]: Sat, 06 Jan 2018 15:48:15 GMT hap-client:http Reading 6 bytes for body...
Caught | 2018-01-06 16:48:15.667 | error | by controller[12]: Sat, 06 Jan 2018 15:48:15 GMT hap-client:http status: HTTP, 1.1, 429, Too Many Requests
Caught | 2018-01-06 16:48:15.667 | error | by controller[11]: Sat, 06 Jan 2018 15:48:15 GMT hap-client:http Request sent
Caught | 2018-01-06 16:48:15.667 | error | by controller[10]: Sat, 06 Jan 2018 15:48:15 GMT hap-client:http raw request (post middleware): 504f5354202f706169722d736574757020485454502f312e310d0a486f73743a203139322e3136382e312e3133363a383038300
Caught | 2018-01-06 16:48:15.666 | error | by controller[9]: Sat, 06 Jan 2018 15:48:15 GMT hap-client:http raw request: 504f5354202f706169722d736574757020485454502f312e310d0a486f73743a203139322e3136382e312e3133363a383038300d0a436f6e74656e742d
Caught | 2018-01-06 16:48:15.665 | error | by controller[8]: Sat, 06 Jan 2018 15:48:15 GMT hap-client:http requesting: POST /pair-setup
Caught | 2018-01-06 16:48:15.665 | error | by controller[7]: Sat, 06 Jan 2018 15:48:15 GMT hap-client:http POSTing to /pair-setup:
Caught | 2018-01-06 16:48:15.665 | error | by controller[6]: Sat, 06 Jan 2018 15:48:15 GMT hap-client:hap encoded request:
Caught | 2018-01-06 16:48:15.665 | error | by controller[5]: Sat, 06 Jan 2018 15:48:15 GMT hap-client:tlv adding 1 bytes of type 6 to the buffer starting at 0
Caught | 2018-01-06 16:48:15.664 | error | by controller[4]: Sat, 06 Jan 2018 15:48:15 GMT hap-client:tlv turning 1 into buffer
Caught | 2018-01-06 16:48:15.664 | error | by controller[3]: Sat, 06 Jan 2018 15:48:15 GMT hap-client:tlv adding 1 bytes of type 0 to the buffer starting at 0
Caught | 2018-01-06 16:48:15.664 | error | by controller[2]: Sat, 06 Jan 2018 15:48:15 GMT hap-client:tlv turning 0 into buffer
Caught | 2018-01-06 16:48:15.664 | error | by controller[1]: Sat, 06 Jan 2018 15:48:15 GMT hap-client:hap Reusing long-term keys
Caught | 2018-01-06 16:48:15.662 | error | by controller[0]: Sat, 06 Jan 2018 15:48:15 GMT hap-client:hap Generating long-term keys
javascript.1 | 2018-01-06 16:48:15.629 | error | at TCP.onread (net.js:547:20)
javascript.1 | 2018-01-06 16:48:15.629 | error | at Socket.Readable.push (_stream_readable.js:134:10)
javascript.1 | 2018-01-06 16:48:15.629 | error | at readableAddChunk (_stream_readable.js:187:13)
javascript.1 | 2018-01-06 16:48:15.629 | error | at emitReadable (_stream_readable.js:426:7)
javascript.1 | 2018-01-06 16:48:15.629 | error | at emitReadable_ (_stream_readable.js:432:10)
javascript.1 | 2018-01-06 16:48:15.629 | error | at Socket.emit (events.js:185:7)
javascript.1 | 2018-01-06 16:48:15.629 | error | at emitNone (events.js:86:13)
javascript.1 | 2018-01-06 16:48:15.629 | error | at Socket.socket.on (/opt/iobroker/node_modules/iobroker.javascript/node_modules/message-socket/dist/index.js:168:22)
javascript.1 | 2018-01-06 16:48:15.629 | error | at Array.forEach (native)
javascript.1 | 2018-01-06 16:48:15.629 | error | at messages.forEach.msg (/opt/iobroker/node_modules/iobroker.javascript/node_modules/message-socket/dist/index.js:175:40)
javascript.1 | 2018-01-06 16:48:15.629 | error | at Subject.next (/opt/iobroker/node_modules/iobroker.javascript/node_modules/message-socket/dist/index.js:60:25)
javascript.1 | 2018-01-06 16:48:15.629 | error | at Array.forEach (native)
javascript.1 | 2018-01-06 16:48:15.629 | error | at _observers.forEach (/opt/iobroker/node_modules/iobroker.javascript/node_modules/message-socket/dist/index.js:63:19)
javascript.1 | 2018-01-06 16:48:15.629 | error | at TakeUntilSubscriber.Subscriber.next (/opt/iobroker/node_modules/iobroker.javascript/node_modules/rxjs/Subscriber.js:90:18)
javascript.1 | 2018-01-06 16:48:15.629 | error | at TakeUntilSubscriber.Subscriber._next (/opt/iobroker/node_modules/iobroker.javascript/node_modules/rxjs/Subscriber.js:126:26)
javascript.1 | 2018-01-06 16:48:15.629 | error | at FilterSubscriber.Subscriber.next (/opt/iobroker/node_modules/iobroker.javascript/node_modules/rxjs/Subscriber.js:90:18)
javascript.1 | 2018-01-06 16:48:15.629 | error | at FilterSubscriber._next (/opt/iobroker/node_modules/iobroker.javascript/node_modules/rxjs/operators/filter.js:89:30)
javascript.1 | 2018-01-06 16:48:15.629 | error | at TakeSubscriber.Subscriber.next (/opt/iobroker/node_modules/iobroker.javascript/node_modules/rxjs/Subscriber.js:90:18)
javascript.1 | 2018-01-06 16:48:15.629 | error | at TakeSubscriber._next (/opt/iobroker/node_modules/iobroker.javascript/node_modules/rxjs/operators/take.js:82:30)
javascript.1 | 2018-01-06 16:48:15.629 | error | at InnerSubscriber.Subscriber.next (/opt/iobroker/node_modules/iobroker.javascript/node_modules/rxjs/Subscriber.js:90:18)
javascript.1 | 2018-01-06 16:48:15.629 | error | at InnerSubscriber._next (/opt/iobroker/node_modules/iobroker.javascript/node_modules/rxjs/InnerSubscriber.js:23:21)
javascript.1 | 2018-01-06 16:48:15.629 | error | at DeferSubscriber.OuterSubscriber.notifyNext (/opt/iobroker/node_modules/iobroker.javascript/node_modules/rxjs/OuterSubscriber.js:19:26)
javascript.1 | 2018-01-06 16:48:15.629 | error | at ExpandSubscriber.Subscriber.next (/opt/iobroker/node_modules/iobroker.javascript/node_modules/rxjs/Subscriber.js:90:18)
javascript.1 | 2018-01-06 16:48:15.629 | error | at ExpandSubscriber._next (/opt/iobroker/node_modules/iobroker.javascript/node_modules/rxjs/operators/expand.js:108:59)
javascript.1 | 2018-01-06 16:48:15.629 | error | at tryCatcher (/opt/iobroker/node_modules/iobroker.javascript/node_modules/rxjs/util/tryCatch.js:6:31)
javascript.1 | 2018-01-06 16:48:15.629 | error | at /opt/iobroker/node_modules/iobroker.javascript/node_modules/hap-client/dist/HapClient.js:117:47
javascript.1 | 2018-01-06 16:48:15.629 | error | Error: Bad status: 429 Too Many Requests
javascript.1 | 2018-01-06 16:48:15.628 | error | uncaught exception: Bad status: 429 Too Many Requests

I tried restarting the hub and ensuring that no other requests are sent but I still get this error.

The environment is Node v6.12.2 on a Raspberry Pi Stretch (headless setup) within the javascript adapter of iobroker.

I already had a hard time to get the dependency to sodium working. For the keytar dependency I get a runtime error when connecting to the dbus so until I get this working I replaced Keytar with a dummy implementation which stores the secrets in memory.

Any help is appreciated as I would really like to get this running to get async notifications not available by the Hue REST api.

Thanks.

Problem installation

Hello and thanks for your module I am trying to install this on a raspberry pi 3 with jessie

I am running homebridge perfectly but i can install your plugin I have this error

pi@raspberrypi:~ $ sudo npm install hap-client --save

[email protected] preinstall /home/pi/node_modules/sodium
node install.js --preinstall

Static libsodium was not found at /home/pi/node_modules/sodium/deps/build/lib/libsodium so compiling libsodium from source.
libtool is required, but wasn't found on this system
Makefile:61: recipe for target 'libsodium' failed
make: *** [libsodium] Error 1
/home/pi/node_modules/sodium/install.js:287
throw new Error(cmdLine + ' exited with code ' + code);
^

Error: make libsodium exited with code 2
at ChildProcess. (/home/pi/node_modules/sodium/install.js:287:19)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
npm WARN enoent ENOENT: no such file or directory, open '/home/pi/package.json'
npm WARN pi No description
npm WARN pi No repository field.
npm WARN pi No README data
npm WARN pi No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] preinstall: node install.js --preinstall
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] preinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2017-12-13T20_03_17_654Z-debug.log

What Do I have to do?

AssertionError [ERR_ASSERTION]: Difference is Invalid

thanks for this library, anyway I got this :

AssertionError [ERR_ASSERTION]: Difference is Invalid
    at BufferReader.move (.\hapclieny\node_modules\buffer-reader\index.js:29:5)
    at EventedHttpClient._parseMessage (.\hapclient\node_modules\hap-client\dist\EventedHttpClient.js:230:24)
    at EventedHttpClient._bufferSplitter (.\hapclient\node_modules\hap-client\dist\EventedHttpClient.js:187:27)
    at Socket.socket.on (.\hapclient\node_modules\message-socket\dist\index.js:157:29)
    at emitNone (events.js:106:13)
    at Socket.emit (events.js:208:7)
    at emitReadable_ (_stream_readable.js:513:10)
    at emitReadable (_stream_readable.js:507:7)
    at addChunk (_stream_readable.js:274:7)
    at readableAddChunk (_stream_readable.js:250:11)

when I try to execute this :

import { Observable, Subject } from 'rxjs';
import HapClient from 'hap-client';

const client = new HapClient('NodeClient', "192.168.1.93", 80);
client
  .pair(
      Observable.of('137-61-085')
  )
  .subscribe({
      complete() {
          console.log("Pairing complete");
      }
  });

any idea ?

I execute this on windows 10

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.