rudders / homebridge-http

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

correct syntax forON_BODY AND OFF_BODY #4

Closed temeyers closed 8 years ago

temeyers commented 8 years ago

@rudders okay so here is the commands i need to commit on or off using curl for my living room lamp however i changed my access token so it wont work for everyone to see i changed one digit to break it

however in config.json there is a on_body and an off_body and thats where i am stuck as you can see ... the homebridge fires up and siri works also my appletv saw the homebridge and made it available on and off of wifi which is great news in itself... can you help me out with the on_body and off_body please ! i have tried everything i can think off for 2 days !

This is the curl command i use turn on my lamp: ​ curl https://api.particle.io/v1/devices/53ff6d066667574813461267/digitalwrite?access_token=7458609c672644bb8d29780fbe60a71f3ce26293 -d params=D2,HIGH

this is the curl command i use to turn off my lamp curl https://api.particle.io/v1/devices/53ff6d066667574813461267/digitalwrite?access_token=7458609c672644bb8d29780fbe60a71f3ce26293 -d params=D2,LOW

this is just part of the accessories section of my config.json

accessories": [ { "accessory": "Http", "name": "Kitchen Lamp", "on_url": "https://api.particle.io/v1/devices/53ff6$ "on_body": "{\"D2, HIGH\"}", "off_url": "https://api.particle.io/v1/devices/53ff$ "off_body": "{\"D2, LOW\"}", "brightness_url": "https://192.168.1.22:3030/device$ "username": "", "password": "", "sendimmediately": "",

temeyers commented 8 years ago

here is the verbose output when i hit the switch or use siri as you can see my response is -1 and nothing is happening

Homebridge is running on port 51826. [Kitchen Lamp] Setting power state to off [Kitchen Lamp] HTTP power function succeeded! [Kitchen Lamp] IncomingMessage { _readableState: ReadableState { objectMode: false, highWaterMark: 16384, buffer: [], length: 0, pipes: null, pipesCount: 0, flowing: true, ended: true, endEmitted: true, reading: false, sync: true, needReadable: false, emittedReadable: false, readableListening: false, defaultEncoding: 'utf8', ranOut: false, awaitDrain: 0, readingMore: false, decoder: null, encoding: null, resumeScheduled: false }, readable: false, domain: null, _events: { end: [ [Function: responseOnEnd], [Function], [Function], [Function] ], close: [ [Function], [Function] ], data: [Function], error: [Function] }, _eventsCount: 4, _maxListeners: undefined, socket: TLSSocket { _tlsOptions: { pipe: null, secureContext: [Object], isServer: false, requestCert: true, rejectUnauthorized: true, session: undefined, NPNProtocols: undefined, requestOCSP: undefined }, _secureEstablished: true, _securePending: false, _newSessionPending: false, _controlReleased: true, _SNICallback: null, servername: null, npnProtocol: undefined, authorized: true, authorizationError: null, encrypted: true, _events: { close: [Object], end: [Object], finish: [Function: onSocketFinish], _socketEnd: [Function: onSocketEnd], secure: [Function], free: [Function: onFree], agentRemove: [Function: onRemove], drain: [Function: ondrain], error: [Object] }, _eventsCount: 9, _connecting: false, _hadError: false, _handle: null, _parent: null, _host: 'api.particle.io', _readableState: ReadableState { objectMode: false, highWaterMark: 16384, buffer: [], length: 0, pipes: null, pipesCount: 0, flowing: true, ended: false, endEmitted: false, reading: true, sync: false, needReadable: true, emittedReadable: false, readableListening: false, defaultEncoding: 'utf8', ranOut: false, awaitDrain: 0, readingMore: false, decoder: null, encoding: null, resumeScheduled: false }, readable: false, domain: null, _maxListeners: 0, _writableState: WritableState { objectMode: false, highWaterMark: 16384, needDrain: false, ending: true, ended: true, finished: true, decodeStrings: false, defaultEncoding: 'utf8', length: 0, writing: false, corked: 0, sync: false, bufferProcessing: false, onwrite: [Function], writecb: null, writelen: 0, bufferedRequest: null, lastBufferedRequest: null, pendingcb: 0, prefinished: true, errorEmitted: false }, writable: false, allowHalfOpen: false, destroyed: true, bytesRead: 317, _bytesDispatched: 195, _sockname: null, _pendingData: null, _pendingEncoding: '', ssl: TLSWrap { _externalStream: {}, fd: -22, _parent: [Object], _parentWrap: undefined, _secureContext: [Object], reading: true, owner: [Circular], onread: [Function: noop], writeQueueSize: 1, onhandshakestart: [Function], onhandshakedone: [Function: bound ], onocspresponse: [Function: bound onocspresponse], onerror: [Function] }, server: undefined, _requestCert: true, _rejectUnauthorized: true, parser: null, _httpMessage: ClientRequest { domain: null, _events: [Object], _eventsCount: 4, _maxListeners: undefined, output: [], outputEncodings: [], outputCallbacks: [], outputSize: 195, writable: true, _last: true, chunkedEncoding: false, shouldKeepAlive: false, useChunkedEncodingByDefault: true, sendDate: false, _removedHeader: [Object], _contentLength: null, _hasBody: true, _trailer: '', finished: true, _headerSent: true, socket: [Circular], connection: [Circular], _header: 'POST /v1/devices/53ff6d066667574813461267/digitalwrite?access_token=7458609c672644bb8d29780fbe60a71f3ce26292 HTTP/1.1\r\nhost: api.particle.io\r\ncontent-length: 12\r\nConnection: close\r\n\r\n', _headers: [Object], _headerNames: [Object], _onPendingData: null, agent: [Object], socketPath: undefined, method: 'POST', path: '/v1/devices/53ff6d066667574813461267/digitalwrite?access_token=7458609c672644bb8d29780fbe60a71f3ce26292', parser: null, res: [Circular] }, read: [Function], _consuming: true, _idleNext: null, _idlePrev: null, _idleTimeout: -1 }, connection: TLSSocket { _tlsOptions: { pipe: null, secureContext: [Object], isServer: false, requestCert: true, rejectUnauthorized: true, session: undefined, NPNProtocols: undefined, requestOCSP: undefined }, _secureEstablished: true, _securePending: false, _newSessionPending: false, _controlReleased: true, _SNICallback: null, servername: null, npnProtocol: undefined, authorized: true, authorizationError: null, encrypted: true, _events: { close: [Object], end: [Object], finish: [Function: onSocketFinish], _socketEnd: [Function: onSocketEnd], secure: [Function], free: [Function: onFree], agentRemove: [Function: onRemove], drain: [Function: ondrain], error: [Object] }, _eventsCount: 9, _connecting: false, _hadError: false, _handle: null, _parent: null, _host: 'api.particle.io', _readableState: ReadableState { objectMode: false, highWaterMark: 16384, buffer: [], length: 0, pipes: null, pipesCount: 0, flowing: true, ended: false, endEmitted: false, reading: true, sync: false, needReadable: true, emittedReadable: false, readableListening: false, defaultEncoding: 'utf8', ranOut: false, awaitDrain: 0, readingMore: false, decoder: null, encoding: null, resumeScheduled: false }, readable: false, domain: null, _maxListeners: 0, _writableState: WritableState { objectMode: false, highWaterMark: 16384, needDrain: false, ending: true, ended: true, finished: true, decodeStrings: false, defaultEncoding: 'utf8', length: 0, writing: false, corked: 0, sync: false, bufferProcessing: false, onwrite: [Function], writecb: null, writelen: 0, bufferedRequest: null, lastBufferedRequest: null, pendingcb: 0, prefinished: true, errorEmitted: false }, writable: false, allowHalfOpen: false, destroyed: true, bytesRead: 317, _bytesDispatched: 195, _sockname: null, _pendingData: null, _pendingEncoding: '', ssl: TLSWrap { _externalStream: {}, fd: -22, _parent: [Object], _parentWrap: undefined, _secureContext: [Object], reading: true, owner: [Circular], onread: [Function: noop], writeQueueSize: 1, onhandshakestart: [Function], onhandshakedone: [Function: bound ], onocspresponse: [Function: bound onocspresponse], onerror: [Function] }, server: undefined, _requestCert: true, _rejectUnauthorized: true, parser: null, _httpMessage: ClientRequest { domain: null, _events: [Object], _eventsCount: 4, _maxListeners: undefined, output: [], outputEncodings: [], outputCallbacks: [], outputSize: 195, writable: true, _last: true, chunkedEncoding: false, shouldKeepAlive: false, useChunkedEncodingByDefault: true, sendDate: false, _removedHeader: [Object], _contentLength: null, _hasBody: true, _trailer: '', finished: true, _headerSent: true, socket: [Circular], connection: [Circular], _header: 'POST /v1/devices/53ff6d066667574813461267/digitalwrite?access_token=7458609c672644bb8d29780fbe60a71f3ce26292 HTTP/1.1\r\nhost: api.particle.io\r\ncontent-length: 12\r\nConnection: close\r\n\r\n', _headers: [Object], _headerNames: [Object], _onPendingData: null, agent: [Object], socketPath: undefined, method: 'POST', path: '/v1/devices/53ff6d066667574813461267/digitalwrite?access_token=7458609c672644bb8d29780fbe60a71f3ce26292', parser: null, res: [Circular] }, read: [Function], _consuming: true, _idleNext: null, _idlePrev: null, idleTimeout: -1 }, httpVersionMajor: 1, httpVersionMinor: 1, httpVersion: '1.1', complete: true, headers: { server: 'nginx/1.6.2', date: 'Thu, 03 Dec 2015 02:33:49 GMT', 'content-type': 'application/json; charset=utf-8', 'content-length': '99', connection: 'close', 'x-powered-by': 'Express', 'access-control-allow-origin': '' }, rawHeaders: [ 'Server', 'nginx/1.6.2', 'Date', 'Thu, 03 Dec 2015 02:33:49 GMT', 'Content-Type', 'application/json; charset=utf-8', 'Content-Length', '99', 'Connection', 'close', 'X-Powered-By', 'Express', 'Access-Control-Allow-Origin', '_' ], trailers: {}, rawTrailers: [], upgrade: false, url: '', method: null, statusCode: 200, statusMessage: 'OK', client: TLSSocket { _tlsOptions: { pipe: null, secureContext: [Object], isServer: false, requestCert: true, rejectUnauthorized: true, session: undefined, NPNProtocols: undefined, requestOCSP: undefined }, _secureEstablished: true, _securePending: false, _newSessionPending: false, _controlReleased: true, _SNICallback: null, servername: null, npnProtocol: undefined, authorized: true, authorizationError: null, encrypted: true, _events: { close: [Object], end: [Object], finish: [Function: onSocketFinish], _socketEnd: [Function: onSocketEnd], secure: [Function], free: [Function: onFree], agentRemove: [Function: onRemove], drain: [Function: ondrain], error: [Object] }, _eventsCount: 9, _connecting: false, _hadError: false, _handle: null, _parent: null, _host: 'api.particle.io', _readableState: ReadableState { objectMode: false, highWaterMark: 16384, buffer: [], length: 0, pipes: null, pipesCount: 0, flowing: true, ended: false, endEmitted: false, reading: true, sync: false, needReadable: true, emittedReadable: false, readableListening: false, defaultEncoding: 'utf8', ranOut: false, awaitDrain: 0, readingMore: false, decoder: null, encoding: null, resumeScheduled: false }, readable: false, domain: null, _maxListeners: 0, _writableState: WritableState { objectMode: false, highWaterMark: 16384, needDrain: false, ending: true, ended: true, finished: true, decodeStrings: false, defaultEncoding: 'utf8', length: 0, writing: false, corked: 0, sync: false, bufferProcessing: false, onwrite: [Function], writecb: null, writelen: 0, bufferedRequest: null, lastBufferedRequest: null, pendingcb: 0, prefinished: true, errorEmitted: false }, writable: false, allowHalfOpen: false, destroyed: true, bytesRead: 317, _bytesDispatched: 195, _sockname: null, _pendingData: null, _pendingEncoding: '', ssl: TLSWrap { _externalStream: {}, fd: -22, _parent: [Object], _parentWrap: undefined, _secureContext: [Object], reading: true, owner: [Circular], onread: [Function: noop], writeQueueSize: 1, onhandshakestart: [Function], onhandshakedone: [Function: bound ], onocspresponse: [Function: bound onocspresponse], onerror: [Function] }, server: undefined, _requestCert: true, _rejectUnauthorized: true, parser: null, _httpMessage: ClientRequest { domain: null, _events: [Object], _eventsCount: 4, _maxListeners: undefined, output: [], outputEncodings: [], outputCallbacks: [], outputSize: 195, writable: true, _last: true, chunkedEncoding: false, shouldKeepAlive: false, useChunkedEncodingByDefault: true, sendDate: false, _removedHeader: [Object], _contentLength: null, _hasBody: true, _trailer: '', finished: true, _headerSent: true, socket: [Circular], connection: [Circular], _header: 'POST /v1/devices/53ff6d066667574813461267/digitalwrite?access_token=7458609c672644bb8d29780fbe60a71f3ce26292 HTTP/1.1\r\nhost: api.particle.io\r\ncontent-length: 12\r\nConnection: close\r\n\r\n', _headers: [Object], _headerNames: [Object], _onPendingData: null, agent: [Object], socketPath: undefined, method: 'POST', path: '/v1/devices/53ff6d066667574813461267/digitalwrite?access_token=7458609c672644bb8d29780fbe60a71f3ce26292', parser: null, res: [Circular] }, read: [Function], _consuming: true, _idleNext: null, _idlePrev: null, _idleTimeout: -1 }, _consuming: true, _dumped: false, req: ClientRequest { domain: null, _events: { socket: [Object], response: [Function: bound ], error: [Function: bound ], drain: [Function] }, _eventsCount: 4, _maxListeners: undefined, output: [], outputEncodings: [], outputCallbacks: [], outputSize: 195, writable: true, _last: true, chunkedEncoding: false, shouldKeepAlive: false, useChunkedEncodingByDefault: true, sendDate: false, _removedHeader: { 'content-length': false }, _contentLength: null, _hasBody: true, _trailer: '', finished: true, _headerSent: true, socket: TLSSocket { _tlsOptions: [Object], _secureEstablished: true, _securePending: false, _newSessionPending: false, _controlReleased: true, _SNICallback: null, servername: null, npnProtocol: undefined, authorized: true, authorizationError: null, encrypted: true, _events: [Object], _eventsCount: 9, _connecting: false, _hadError: false, _handle: null, _parent: null, _host: 'api.particle.io', _readableState: [Object], readable: false, domain: null, _maxListeners: 0, _writableState: [Object], writable: false, allowHalfOpen: false, destroyed: true, bytesRead: 317, _bytesDispatched: 195, _sockname: null, _pendingData: null, _pendingEncoding: '', ssl: [Object], server: undefined, _requestCert: true, _rejectUnauthorized: true, parser: null, _httpMessage: [Circular], read: [Function], _consuming: true, _idleNext: null, _idlePrev: null, _idleTimeout: -1 }, connection: TLSSocket { _tlsOptions: [Object], _secureEstablished: true, _securePending: false, _newSessionPending: false, _controlReleased: true, _SNICallback: null, servername: null, npnProtocol: undefined, authorized: true, authorizationError: null, encrypted: true, _events: [Object], _eventsCount: 9, _connecting: false, _hadError: false, _handle: null, _parent: null, _host: 'api.particle.io', _readableState: [Object], readable: false, domain: null, _maxListeners: 0, _writableState: [Object], writable: false, allowHalfOpen: false, destroyed: true, bytesRead: 317, _bytesDispatched: 195, _sockname: null, _pendingData: null, _pendingEncoding: '', ssl: [Object], server: undefined, _requestCert: true, _rejectUnauthorized: true, parser: null, _httpMessage: [Circular], read: [Function], _consuming: true, _idleNext: null, _idlePrev: null, _idleTimeout: -1 }, _header: 'POST /v1/devices/53ff6d066667574813461267/digitalwrite?access_token=7458609c672644bb8d29780fbe60a71f3ce26292 HTTP/1.1\r\nhost: api.particle.io\r\ncontent-length: 12\r\nConnection: close\r\n\r\n', _headers: { host: 'api.particle.io', 'content-length': 12 }, _headerNames: { host: 'host', 'content-length': 'content-length' }, _onPendingData: null, agent: Agent { domain: null, _events: [Object], _eventsCount: 1, _maxListeners: undefined, defaultPort: 443, protocol: 'https:', options: [Object], requests: {}, sockets: [Object], freeSockets: {}, keepAliveMsecs: 1000, keepAlive: false, maxSockets: Infinity, maxFreeSockets: 256, maxCachedSessions: 100, _sessionCache: [Object] }, socketPath: undefined, method: 'POST', path: '/v1/devices/53ff6d066667574813461267/digitalwrite?access_token=7458609c672644bb8d29780fbe60a71f3ce26292', parser: null, res: [Circular] }, request: Request { domain: null, _events: { error: [Function: bound ], complete: [Function: bound ], pipe: [Function], end: [Object], data: [Function] }, _eventsCount: 5, _maxListeners: undefined, callback: [Function], method: 'POST', body: '{"D2":"LOW"}', readable: true, writable: true, explicitMethod: true, _qs: Querystring { request: [Circular], lib: [Object], useQuerystring: undefined, parseOptions: {}, stringifyOptions: {} }, _auth: Auth { request: [Circular], hasAuth: true, sentAuth: false, bearerToken: null, user: '', pass: '' }, _oauth: OAuth { request: [Circular], params: null }, _multipart: Multipart { request: [Circular], boundary: '39346acd-c9b9-4806-96f2-dea39d8f4c6a', chunked: false, body: null }, _redirect: Redirect { request: [Circular], followRedirect: true, followRedirects: true, followAllRedirects: false, allowRedirect: [Function], maxRedirects: 10, redirects: [], redirectsFollowed: 0, removeRefererHeader: false }, _tunnel: Tunnel { request: [Circular], proxyHeaderWhiteList: [Object], proxyHeaderExclusiveList: [] }, headers: { 'content-length': 12 }, setHeader: [Function], hasHeader: [Function], getHeader: [Function], removeHeader: [Function], localAddress: undefined, pool: {}, dests: [], __isRequestRequest: true, _callback: [Function], uri: Url { protocol: 'https:', slashes: true, auth: null, host: 'api.particle.io', port: 443, hostname: 'api.particle.io', hash: null, search: '?access_token=7458609c672644bb8d29780fbe60a71f3ce26292', query: 'access_token=7458609c672644bb8d29780fbe60a71f3ce26292', pathname: '/v1/devices/53ff6d066667574813461267/digitalwrite', path: '/v1/devices/53ff6d066667574813461267/digitalwrite?access_token=7458609c672644bb8d29780fbe60a71f3ce26292', href: 'https://api.particle.io/v1/devices/53ff6d066667574813461267/digitalwrite?access_token=7458609c672644bb8d29780fbe60a71f3ce26292' }, proxy: null, tunnel: true, setHost: true, originalCookieHeader: undefined, _disableCookies: true, _jar: undefined, port: 443, host: 'api.particle.io', path: '/v1/devices/53ff6d066667574813461267/digitalwrite?accesstoken=7458609c672644bb8d29780fbe60a71f3ce26292', httpModule: { Server: [Object], createServer: [Function], globalAgent: [Object], Agent: [Object], request: [Function], get: [Function] }, agentClass: { [Function: Agent] super: [Object] }, agent: Agent { domain: null, _events: [Object], _eventsCount: 1, _maxListeners: undefined, defaultPort: 443, protocol: 'https:', options: [Object], requests: {}, sockets: [Object], freeSockets: {}, keepAliveMsecs: 1000, keepAlive: false, maxSockets: Infinity, maxFreeSockets: 256, maxCachedSessions: 100, _sessionCache: [Object] }, _started: true, href: 'https://api.particle.io/v1/devices/53ff6d066667574813461267/digitalwrite?access_token=7458609c672644bb8d29780fbe60a71f3ce26292', req: ClientRequest { domain: null, _events: [Object], _eventsCount: 4, _maxListeners: undefined, output: [], outputEncodings: [], outputCallbacks: [], outputSize: 195, writable: true, _last: true, chunkedEncoding: false, shouldKeepAlive: false, useChunkedEncodingByDefault: true, sendDate: false, _removedHeader: [Object], _contentLength: null, _hasBody: true, _trailer: '', finished: true, _headerSent: true, socket: [Object], connection: [Object], _header: 'POST /v1/devices/53ff6d066667574813461267/digitalwrite?access_token=7458609c672644bb8d29780fbe60a71f3ce26292 HTTP/1.1\r\nhost: api.particle.io\r\ncontent-length: 12\r\nConnection: close\r\n\r\n', _headers: [Object], _headerNames: [Object], _onPendingData: null, agent: [Object], socketPath: undefined, method: 'POST', path: '/v1/devices/53ff6d066667574813461267/digitalwrite?access_token=7458609c672644bb8d29780fbe60a71f3ce26292', parser: null, res: [Circular] }, ntick: true, response: [Circular], originalHost: 'api.particle.io', originalHostHeaderName: 'host', responseContent: [Circular], _destdata: true, _ended: true, callbackCalled: true }, toJSON: [Function: responseToJSON], caseless: Caseless { dict: { server: 'nginx/1.6.2', date: 'Thu, 03 Dec 2015 02:33:49 GMT', 'content-type': 'application/json; charset=utf-8', 'content-length': '99', connection: 'close', 'x-powered-by': 'Express', 'access-control-allow-origin': '' } }, read: [Function], body: '{\n "id": "53ff6d066667574813461267",\n "last_app": "",\n "connected": true,\n "return_value": -1\n}' } [Kitchen Lamp] { "id": "53ff6d066667574813461267", "last_app": "", "connected": true, "return_value": -1 } [Kitchen Lamp] Setting power state to on [Kitchen Lamp] HTTP power function succeeded! [Kitchen Lamp] IncomingMessage { _readableState: ReadableState { objectMode: false, highWaterMark: 16384, buffer: [], length: 0, pipes: null, pipesCount: 0, flowing: true, ended: true, endEmitted: true, reading: false, sync: true, needReadable: false, emittedReadable: false, readableListening: false, defaultEncoding: 'utf8', ranOut: false, awaitDrain: 0, readingMore: false, decoder: null, encoding: null, resumeScheduled: false }, readable: false, domain: null, _events: { end: [ [Function: responseOnEnd], [Function], [Function], [Function] ], close: [ [Function], [Function] ], data: [Function], error: [Function] }, _eventsCount: 4, _maxListeners: undefined, socket: TLSSocket { _tlsOptions: { pipe: null, secureContext: [Object], isServer: false, requestCert: true, rejectUnauthorized: true, session: <Buffer 30 82 06 83 02 01 01 02 02 03 03 04 02 c0 2f 04 20 59 84 53 e9 17 80 52 d5 b6 ab ce 88 97 c9 1b 89 70 3d be 56 a8 54 fe d0 33 c1 57 1e dd 63 26 2f 04 ... >, NPNProtocols: undefined, requestOCSP: undefined }, _secureEstablished: true, _securePending: false, _newSessionPending: false, _controlReleased: true, _SNICallback: null, servername: null, npnProtocol: undefined, authorized: true, authorizationError: null, encrypted: true, _events: { close: [Object], end: [Object], finish: [Function: onSocketFinish], _socketEnd: [Function: onSocketEnd], secure: [Function], free: [Function: onFree], agentRemove: [Function: onRemove], drain: [Function: ondrain], error: [Object] }, _eventsCount: 9, _connecting: false, _hadError: false, _handle: null, _parent: null, _host: 'api.particle.io', _readableState: ReadableState { objectMode: false, highWaterMark: 16384, buffer: [], length: 0, pipes: null, pipesCount: 0, flowing: true, ended: false, endEmitted: false, reading: true, sync: false, needReadable: true, emittedReadable: false, readableListening: false, defaultEncoding: 'utf8', ranOut: false, awaitDrain: 0, readingMore: false, decoder: null, encoding: null, resumeScheduled: false }, readable: false, domain: null, _maxListeners: 0, _writableState: WritableState { objectMode: false, highWaterMark: 16384, needDrain: false, ending: true, ended: true, finished: true, decodeStrings: false, defaultEncoding: 'utf8', length: 0, writing: false, corked: 0, sync: false, bufferProcessing: false, onwrite: [Function], writecb: null, writelen: 0, bufferedRequest: null, lastBufferedRequest: null, pendingcb: 0, prefinished: true, errorEmitted: false }, writable: false, allowHalfOpen: false, destroyed: true, bytesRead: 317, _bytesDispatched: 196, _sockname: null, _pendingData: null, _pendingEncoding: '', ssl: TLSWrap { _externalStream: {}, fd: -22, _parent: [Object], _parentWrap: undefined, _secureContext: [Object], reading: true, owner: [Circular], onread: [Function: noop], writeQueueSize: 1, onhandshakestart: [Function], onhandshakedone: [Function: bound ], onocspresponse: [Function: bound onocspresponse], onerror: [Function] }, server: undefined, _requestCert: true, _rejectUnauthorized: true, parser: null, _httpMessage: ClientRequest { domain: null, _events: [Object], _eventsCount: 4, _maxListeners: undefined, output: [], outputEncodings: [], outputCallbacks: [], outputSize: 196, writable: true, _last: true, chunkedEncoding: false, shouldKeepAlive: false, useChunkedEncodingByDefault: true, sendDate: false, _removedHeader: [Object], _contentLength: null, _hasBody: true, _trailer: '', finished: true, _headerSent: true, socket: [Circular], connection: [Circular], _header: 'POST /v1/devices/53ff6d066667574813461267/digitalwrite?access_token=7458609c672644bb8d29780fbe60a71f3ce26292 HTTP/1.1\r\nhost: api.particle.io\r\ncontent-length: 13\r\nConnection: close\r\n\r\n', _headers: [Object], _headerNames: [Object], _onPendingData: null, agent: [Object], socketPath: undefined, method: 'POST', path: '/v1/devices/53ff6d066667574813461267/digitalwrite?access_token=7458609c672644bb8d29780fbe60a71f3ce26292', parser: null, res: [Circular] }, read: [Function], _consuming: true, _idleNext: null, _idlePrev: null, _idleTimeout: -1 }, connection: TLSSocket { _tlsOptions: { pipe: null, secureContext: [Object], isServer: false, requestCert: true, rejectUnauthorized: true, session: <Buffer 30 82 06 83 02 01 01 02 02 03 03 04 02 c0 2f 04 20 59 84 53 e9 17 80 52 d5 b6 ab ce 88 97 c9 1b 89 70 3d be 56 a8 54 fe d0 33 c1 57 1e dd 63 26 2f 04 ... >, NPNProtocols: undefined, requestOCSP: undefined }, _secureEstablished: true, _securePending: false, _newSessionPending: false, _controlReleased: true, _SNICallback: null, servername: null, npnProtocol: undefined, authorized: true, authorizationError: null, encrypted: true, _events: { close: [Object], end: [Object], finish: [Function: onSocketFinish], _socketEnd: [Function: onSocketEnd], secure: [Function], free: [Function: onFree], agentRemove: [Function: onRemove], drain: [Function: ondrain], error: [Object] }, _eventsCount: 9, _connecting: false, _hadError: false, _handle: null, _parent: null, _host: 'api.particle.io', _readableState: ReadableState { objectMode: false, highWaterMark: 16384, buffer: [], length: 0, pipes: null, pipesCount: 0, flowing: true, ended: false, endEmitted: false, reading: true, sync: false, needReadable: true, emittedReadable: false, readableListening: false, defaultEncoding: 'utf8', ranOut: false, awaitDrain: 0, readingMore: false, decoder: null, encoding: null, resumeScheduled: false }, readable: false, domain: null, _maxListeners: 0, _writableState: WritableState { objectMode: false, highWaterMark: 16384, needDrain: false, ending: true, ended: true, finished: true, decodeStrings: false, defaultEncoding: 'utf8', length: 0, writing: false, corked: 0, sync: false, bufferProcessing: false, onwrite: [Function], writecb: null, writelen: 0, bufferedRequest: null, lastBufferedRequest: null, pendingcb: 0, prefinished: true, errorEmitted: false }, writable: false, allowHalfOpen: false, destroyed: true, bytesRead: 317, _bytesDispatched: 196, _sockname: null, _pendingData: null, _pendingEncoding: '', ssl: TLSWrap { _externalStream: {}, fd: -22, _parent: [Object], _parentWrap: undefined, _secureContext: [Object], reading: true, owner: [Circular], onread: [Function: noop], writeQueueSize: 1, onhandshakestart: [Function], onhandshakedone: [Function: bound ], onocspresponse: [Function: bound onocspresponse], onerror: [Function] }, server: undefined, _requestCert: true, _rejectUnauthorized: true, parser: null, _httpMessage: ClientRequest { domain: null, _events: [Object], _eventsCount: 4, _maxListeners: undefined, output: [], outputEncodings: [], outputCallbacks: [], outputSize: 196, writable: true, _last: true, chunkedEncoding: false, shouldKeepAlive: false, useChunkedEncodingByDefault: true, sendDate: false, _removedHeader: [Object], _contentLength: null, _hasBody: true, _trailer: '', finished: true, _headerSent: true, socket: [Circular], connection: [Circular], _header: 'POST /v1/devices/53ff6d066667574813461267/digitalwrite?access_token=7458609c672644bb8d29780fbe60a71f3ce26292 HTTP/1.1\r\nhost: api.particle.io\r\ncontent-length: 13\r\nConnection: close\r\n\r\n', _headers: [Object], _headerNames: [Object], _onPendingData: null, agent: [Object], socketPath: undefined, method: 'POST', path: '/v1/devices/53ff6d066667574813461267/digitalwrite?access_token=7458609c672644bb8d29780fbe60a71f3ce26292', parser: null, res: [Circular] }, read: [Function], _consuming: true, _idleNext: null, _idlePrev: null, idleTimeout: -1 }, httpVersionMajor: 1, httpVersionMinor: 1, httpVersion: '1.1', complete: true, headers: { server: 'nginx/1.6.2', date: 'Thu, 03 Dec 2015 02:33:53 GMT', 'content-type': 'application/json; charset=utf-8', 'content-length': '99', connection: 'close', 'x-powered-by': 'Express', 'access-control-allow-origin': '' }, rawHeaders: [ 'Server', 'nginx/1.6.2', 'Date', 'Thu, 03 Dec 2015 02:33:53 GMT', 'Content-Type', 'application/json; charset=utf-8', 'Content-Length', '99', 'Connection', 'close', 'X-Powered-By', 'Express', 'Access-Control-Allow-Origin', '*' ], trailers: {}, rawTrailers: [], upgrade: false, url: '', method: null, statusCode: 200, statusMessage: 'OK', client: TLSSocket { _tlsOptions: { pipe: null, secureContext: [Object], isServer: false, requestCert: true, rejectUnauthorized: true, session: <Buffer 30 82 06 83 02 01 01 02 02 03 03 04 02 c0 2f 04 20 59 84 53 e9 17 80 52 d5 b6 ab ce 88 97 c9 1b 89 70 3d be 56 a8 54 fe d0 33 c1 57 1e dd 63 26 2f 04 ... >, NPNProtocols: undefined, requestOCSP: undefined }, _secureEstablished: true, _securePending: false, _newSessionPending: false, _controlReleased: true, _SNICallback: null, servername: null, npnProtocol: undefined, authorized: true, authorizationError: null, encrypted: true, _events: { close: [Object], end: [Object], finish: [Function: onSocketFinish], _socketEnd: [Function: onSocketEnd], secure: [Function], free: [Function: onFree], agentRemove: [Function: onRemove], drain: [Function: ondrain], error: [Object] }, _eventsCount: 9, _connecting: false, _hadError: false, _handle: null, _parent: null, _host: 'api.particle.io', _readableState: ReadableState { objectMode: false, highWaterMark: 16384, buffer: [], length: 0, pipes: null, pipesCount: 0, flowing: true, ended: false, endEmitted: false, reading: true, sync: false, needReadable: true, emittedReadable: false, readableListening: false, defaultEncoding: 'utf8', ranOut: false, awaitDrain: 0, readingMore: false, decoder: null, encoding: null, resumeScheduled: false }, readable: false, domain: null, _maxListeners: 0, _writableState: WritableState { objectMode: false, highWaterMark: 16384, needDrain: false, ending: true, ended: true, finished: true, decodeStrings: false, defaultEncoding: 'utf8', length: 0, writing: false, corked: 0, sync: false, bufferProcessing: false, onwrite: [Function], writecb: null, writelen: 0, bufferedRequest: null, lastBufferedRequest: null, pendingcb: 0, prefinished: true, errorEmitted: false }, writable: false, allowHalfOpen: false, destroyed: true, bytesRead: 317, _bytesDispatched: 196, _sockname: null, _pendingData: null, _pendingEncoding: '', ssl: TLSWrap { _externalStream: {}, fd: -22, _parent: [Object], _parentWrap: undefined, _secureContext: [Object], reading: true, owner: [Circular], onread: [Function: noop], writeQueueSize: 1, onhandshakestart: [Function], onhandshakedone: [Function: bound ], onocspresponse: [Function: bound onocspresponse], onerror: [Function] }, server: undefined, _requestCert: true, _rejectUnauthorized: true, parser: null, _httpMessage: ClientRequest { domain: null, _events: [Object], _eventsCount: 4, _maxListeners: undefined, output: [], outputEncodings: [], outputCallbacks: [], outputSize: 196, writable: true, _last: true, chunkedEncoding: false, shouldKeepAlive: false, useChunkedEncodingByDefault: true, sendDate: false, _removedHeader: [Object], _contentLength: null, _hasBody: true, _trailer: '', finished: true, _headerSent: true, socket: [Circular], connection: [Circular], _header: 'POST /v1/devices/53ff6d066667574813461267/digitalwrite?access_token=7458609c672644bb8d29780fbe60a71f3ce26292 HTTP/1.1\r\nhost: api.particle.io\r\ncontent-length: 13\r\nConnection: close\r\n\r\n', _headers: [Object], _headerNames: [Object], _onPendingData: null, agent: [Object], socketPath: undefined, method: 'POST', path: '/v1/devices/53ff6d066667574813461267/digitalwrite?access_token=7458609c672644bb8d29780fbe60a71f3ce26292', parser: null, res: [Circular] }, read: [Function], _consuming: true, _idleNext: null, _idlePrev: null, _idleTimeout: -1 }, _consuming: true, _dumped: false, req: ClientRequest { domain: null, _events: { socket: [Object], response: [Function: bound ], error: [Function: bound ], drain: [Function] }, _eventsCount: 4, _maxListeners: undefined, output: [], outputEncodings: [], outputCallbacks: [], outputSize: 196, writable: true, _last: true, chunkedEncoding: false, shouldKeepAlive: false, useChunkedEncodingByDefault: true, sendDate: false, _removedHeader: { 'content-length': false }, _contentLength: null, _hasBody: true, _trailer: '', finished: true, _headerSent: true, socket: TLSSocket { _tlsOptions: [Object], _secureEstablished: true, _securePending: false, _newSessionPending: false, _controlReleased: true, _SNICallback: null, servername: null, npnProtocol: undefined, authorized: true, authorizationError: null, encrypted: true, _events: [Object], _eventsCount: 9, _connecting: false, _hadError: false, _handle: null, _parent: null, _host: 'api.particle.io', _readableState: [Object], readable: false, domain: null, _maxListeners: 0, _writableState: [Object], writable: false, allowHalfOpen: false, destroyed: true, bytesRead: 317, _bytesDispatched: 196, _sockname: null, _pendingData: null, _pendingEncoding: '', ssl: [Object], server: undefined, _requestCert: true, _rejectUnauthorized: true, parser: null, _httpMessage: [Circular], read: [Function], _consuming: true, _idleNext: null, _idlePrev: null, _idleTimeout: -1 }, connection: TLSSocket { _tlsOptions: [Object], _secureEstablished: true, _securePending: false, _newSessionPending: false, _controlReleased: true, _SNICallback: null, servername: null, npnProtocol: undefined, authorized: true, authorizationError: null, encrypted: true, _events: [Object], _eventsCount: 9, _connecting: false, _hadError: false, _handle: null, _parent: null, _host: 'api.particle.io', _readableState: [Object], readable: false, domain: null, _maxListeners: 0, _writableState: [Object], writable: false, allowHalfOpen: false, destroyed: true, bytesRead: 317, _bytesDispatched: 196, _sockname: null, _pendingData: null, _pendingEncoding: '', ssl: [Object], server: undefined, _requestCert: true, _rejectUnauthorized: true, parser: null, _httpMessage: [Circular], read: [Function], _consuming: true, _idleNext: null, _idlePrev: null, _idleTimeout: -1 }, _header: 'POST /v1/devices/53ff6d066667574813461267/digitalwrite?access_token=7458609c672644bb8d29780fbe60a71f3ce26292 HTTP/1.1\r\nhost: api.particle.io\r\ncontent-length: 13\r\nConnection: close\r\n\r\n', _headers: { host: 'api.particle.io', 'content-length': 13 }, _headerNames: { host: 'host', 'content-length': 'content-length' }, _onPendingData: null, agent: Agent { domain: null, _events: [Object], _eventsCount: 1, _maxListeners: undefined, defaultPort: 443, protocol: 'https:', options: [Object], requests: {}, sockets: [Object], freeSockets: {}, keepAliveMsecs: 1000, keepAlive: false, maxSockets: Infinity, maxFreeSockets: 256, maxCachedSessions: 100, _sessionCache: [Object] }, socketPath: undefined, method: 'POST', path: '/v1/devices/53ff6d066667574813461267/digitalwrite?access_token=7458609c672644bb8d29780fbe60a71f3ce26292', parser: null, res: [Circular] }, request: Request { domain: null, _events: { error: [Function: bound ], complete: [Function: bound ], pipe: [Function], end: [Object], data: [Function] }, _eventsCount: 5, _maxListeners: undefined, callback: [Function], method: 'POST', body: '{"D2":"HIGH"}', readable: true, writable: true, explicitMethod: true, _qs: Querystring { request: [Circular], lib: [Object], useQuerystring: undefined, parseOptions: {}, stringifyOptions: {} }, _auth: Auth { request: [Circular], hasAuth: true, sentAuth: false, bearerToken: null, user: '', pass: '' }, _oauth: OAuth { request: [Circular], params: null }, _multipart: Multipart { request: [Circular], boundary: '50ff732f-b345-4e8f-bfd6-6ff1973650f9', chunked: false, body: null }, _redirect: Redirect { request: [Circular], followRedirect: true, followRedirects: true, followAllRedirects: false, allowRedirect: [Function], maxRedirects: 10, redirects: [], redirectsFollowed: 0, removeRefererHeader: false }, _tunnel: Tunnel { request: [Circular], proxyHeaderWhiteList: [Object], proxyHeaderExclusiveList: [] }, headers: { 'content-length': 13 }, setHeader: [Function], hasHeader: [Function], getHeader: [Function], removeHeader: [Function], localAddress: undefined, pool: {}, dests: [], __isRequestRequest: true, _callback: [Function], uri: Url { protocol: 'https:', slashes: true, auth: null, host: 'api.particle.io', port: 443, hostname: 'api.particle.io', hash: null, search: '?access_token=7458609c672644bb8d29780fbe60a71f3ce26292', query: 'access_token=7458609c672644bb8d29780fbe60a71f3ce26292', pathname: '/v1/devices/53ff6d066667574813461267/digitalwrite', path: '/v1/devices/53ff6d066667574813461267/digitalwrite?access_token=7458609c672644bb8d29780fbe60a71f3ce26292', href: 'https://api.particle.io/v1/devices/53ff6d066667574813461267/digitalwrite?access_token=7458609c672644bb8d29780fbe60a71f3ce26292' }, proxy: null, tunnel: true, setHost: true, originalCookieHeader: undefined, _disableCookies: true, _jar: undefined, port: 443, host: 'api.particle.io', path: '/v1/devices/53ff6d066667574813461267/digitalwrite?accesstoken=7458609c672644bb8d29780fbe60a71f3ce26292', httpModule: { Server: [Object], createServer: [Function], globalAgent: [Object], Agent: [Object], request: [Function], get: [Function] }, agentClass: { [Function: Agent] super: [Object] }, agent: Agent { domain: null, _events: [Object], _eventsCount: 1, _maxListeners: undefined, defaultPort: 443, protocol: 'https:', options: [Object], requests: {}, sockets: [Object], freeSockets: {}, keepAliveMsecs: 1000, keepAlive: false, maxSockets: Infinity, maxFreeSockets: 256, maxCachedSessions: 100, _sessionCache: [Object] }, _started: true, href: 'https://api.particle.io/v1/devices/53ff6d066667574813461267/digitalwrite?access_token=7458609c672644bb8d29780fbe60a71f3ce26292', req: ClientRequest { domain: null, _events: [Object], _eventsCount: 4, _maxListeners: undefined, output: [], outputEncodings: [], outputCallbacks: [], outputSize: 196, writable: true, _last: true, chunkedEncoding: false, shouldKeepAlive: false, useChunkedEncodingByDefault: true, sendDate: false, _removedHeader: [Object], _contentLength: null, _hasBody: true, _trailer: '', finished: true, _headerSent: true, socket: [Object], connection: [Object], _header: 'POST /v1/devices/53ff6d066667574813461267/digitalwrite?access_token=7458609c672644bb8d29780fbe60a71f3ce26292 HTTP/1.1\r\nhost: api.particle.io\r\ncontent-length: 13\r\nConnection: close\r\n\r\n', _headers: [Object], _headerNames: [Object], _onPendingData: null, agent: [Object], socketPath: undefined, method: 'POST', path: '/v1/devices/53ff6d066667574813461267/digitalwrite?access_token=7458609c672644bb8d29780fbe60a71f3ce26292', parser: null, res: [Circular] }, ntick: true, response: [Circular], originalHost: 'api.particle.io', originalHostHeaderName: 'host', responseContent: [Circular], _destdata: true, _ended: true, _callbackCalled: true }, toJSON: [Function: responseToJSON], caseless: Caseless { dict: { server: 'nginx/1.6.2', date: 'Thu, 03 Dec 2015 02:33:53 GMT', 'content-type': 'application/json; charset=utf-8', 'content-length': '99', connection: 'close', 'x-powered-by': 'Express', 'access-control-allow-origin': '*' } }, read: [Function], body: '{\n "id": "53ff6d066667574813461267",\n "last_app": "",\n "connected": true,\n "return_value": -1\n}' } [Kitchen Lamp] { "id": "53ff6d066667574813461267", "last_app": "", "connected": true, "return_value": -1 }

MPV commented 8 years ago

Have you tried sending without {}?

For example: "D2, HIGH" vs "{\"D2, HIGH\"}",

3 dec. 2015 kl. 03:16 skrev temeyers notifications@github.com:

okay so here is the commands i need to commit on or off using curl for my living room lamp however i changed my access token so it wont work for everyone to see i changed one digit to break it

however in config.json there is a on_body and an off_body and thats where i am stuck as you can see ... the homebridge fires up and siri works also my appletv saw the homebridge and made it available on and off of wifi which is great news in itself... can you help me out with the on_body and off_body please ! i have tried everything i can think off for 2 days !

This is the curl command i use turn on my lamp: ​ curl https://api.particle.io/v1/devices/53ff6d066667574813461267/digitalwrite?access_token=7458609c672644bb8d29780fbe60a71f3ce26293 -d params=D2,HIGH

this is the curl command i use to turn off my lamp curl https://api.particle.io/v1/devices/53ff6d066667574813461267/digitalwrite?access_token=7458609c672644bb8d29780fbe60a71f3ce26293 -d params=D2,LOW

this is just part of the accessories section of my config.json

accessories": [ { "accessory": "Http", "name": "Kitchen Lamp", "on_url": "https://api.particle.io/v1/devices/53ff6$ "on_body": "{\"D2, HIGH\"}", "off_url": "https://api.particle.io/v1/devices/53ff$ "off_body": "{\"D2, LOW\"}", "brightness_url": "https://192.168.1.22:3030/device$ "username": "", "password": "", "sendimmediately": "",

— Reply to this email directly or view it on GitHub.

rudders commented 8 years ago

Did this resolve your issue?

temeyers commented 8 years ago

yes i did thank you … is there a way to use the http to request data like humidity ? i am using this temporarily until the particle photon accessory is created

On Jan 4, 2016, at 12:42 PM, Adrian Rudman notifications@github.com wrote:

Did this resolve your issue?

— Reply to this email directly or view it on GitHub https://github.com/rudders/homebridge-http/issues/4#issuecomment-168763744.

rudders commented 8 years ago

There are lots of forks of this repo - have a look around - someone will have done something similar - there's an advanced plugin in the works too.

temeyers commented 8 years ago

awesome thanks

On Jan 4, 2016, at 2:30 PM, Adrian Rudman notifications@github.com wrote:

There are lots of forks of this repo - have a look around - someone will have done something similar - there's an advanced plugin in the works too.

— Reply to this email directly or view it on GitHub https://github.com/rudders/homebridge-http/issues/4#issuecomment-168795841.