Skip to content

Latest commit

 

History

History
284 lines (176 loc) · 7.66 KB

API.md

File metadata and controls

284 lines (176 loc) · 7.66 KB

Table of Contents

HAPNodeJSClient

HAPNodeJSClient - Client for Homebridge and HAP-NodeJS in insecure mode.

Events

Parameters

  • options type description

Properties

  • debug boolean Enable debug logging, defaults to false
  • pin string Homebridge PIN, defaults to '031-45-154'
  • refresh number Discovery refresh, defaults to 15 minutes
  • timeout number Discovery timeout, defaults to 20 seconds
  • reqTimeout number Accessory request timeout, defaults to 7 seconds

HAPaccessories

HAPNodeJSClient.prototype.HAPaccessories - Returns an array of all homebridge instances, and the accessories for each.

Parameters

  • callback type description

Returns type description

HAPcontrolByDeviceID

HAPNodeJSClient.prototype.HAPcontrolByDeviceID - Send a characteristic PUT Message to a particular homebridge instance

Parameters

  • deviceID type deviceID of homebridge instance
  • body type An array of HomeKit characteristic updates, [{ "aid": 2, "iid": 9, "value": 0}]
  • callback type Callback to execute upon completion of characteristic setting, function(err, response)

HAPcontrol

HAPNodeJSClient.prototype.HAPcontrol - Send a characteristic PUT Message to a particular homebridge instance

Parameters

  • ipAddress type IP Address of homebridge instance
  • port type Port of homebridge instance
  • body type An array of HomeKit characteristic updates, [{ "aid": 2, "iid": 9, "value": 0}]
  • callback type Callback to execute upon completion of characteristic setting, function(err, response)

HAPeventByDeviceID

HAPNodeJSClient.prototype.HAPeventByDeviceID - Send a characteristic PUT Message to a particular homebridge instance, this maintains a socket connection for use in returning Events

Parameters

  • deviceID type deviceID homebridge instance
  • body type An array of HomeKit characteristic updates, [{ "aid": 2, "iid": 9, "value": 0}]
  • callback type Callback to execute upon completion of characteristic setting, function(err, response)

HAPevent

HAPNodeJSClient.prototype.HAPevent - Send a characteristic PUT Message to a particular homebridge instance, this maintains a socket connection for use in returning Events

Parameters

  • ipAddress type IP Address of homebridge instance
  • port type Port of homebridge instance
  • body type An array of HomeKit characteristic updates, [{ "aid": 2, "iid": 9, "value": 0}]
  • callback type Callback to execute upon completion of characteristic setting, function(err, response)

HAPresourceByDeviceID

HAPNodeJSClient.prototype.HAPresourceByDeviceID - Send a characteristic PUT Message to a particular homebridge instance using resource interface, ie camera

Parameters

  • deviceID
  • body type An array of HomeKit characteristic updates, [{ "aid": 2, "iid": 9, "value": 0}]
  • callback type Callback to execute upon completion of characteristic setting, function(err, response)
  • DeviceID type DeviceID of homebridge instance

HAPresource

HAPNodeJSClient.prototype.HAPresource - Send a characteristic PUT Message to a particular homebridge instance using resource interface, ie camera

Parameters

  • ipAddress type IP Address of homebridge instance
  • port type Port of homebridge instance
  • body type An array of HomeKit characteristic updates, [{ "aid": 2, "iid": 9, "value": 0}]
  • callback type Callback to execute upon completion of characteristic setting, function(err, response)

HAPstatusByDeviceID

HAPNodeJSClient.prototype.HAPstatusByDeviceID - Get current status for characteristics

Parameters

  • deviceID type deviceID of homebridge instance
  • body type description
  • callback type Callback to execute upon completion of characteristic getting, function(err, response)

HAPstatus

HAPNodeJSClient.prototype.HAPstatus - Get current status for characteristics

Parameters

  • ipAddress type IP Address of homebridge instance
  • port type Port of homebridge instance
  • body type description
  • callback type Callback to execute upon completion of characteristic getting, function(err, response)

HAPNodeJSClient#Disconnected

HomeKit Accessory Characteristic event pass thru

Properties

  • server string IP Address and port of disconnected homebridge

Examples

Sample Message

{ host: '192.168.1.4', port: 51826, aid: 16, iid: 11, status: false }

HAPNodeJSClient#hapEvent

HomeKit Accessory Characteristic event pass thru

Properties

  • host string IP Address of homebridge instance generating event
  • port number Port of homebridge instance generating event
  • deviceID number deviceID of homebridge instance generating event
  • aid number Accessory ID of accessory generating event
  • iid number Instance ID of accessory characteristic generating event
  • value object Updated characteristic value

Examples

Sample Message

{ host: '192.168.1.4', port: 51826, aid: 16, iid: 11, status: false }

_reconnectServer

_reconnectServer - Reconnect to event server

Parameters

  • server type IP Address and port of disconnected homebridge server

Returns type description

services

Ensure UUIDs are long form

Request

var q - Message queuing to prevent requests overstepping each other

Parameters

  • options
  • function type (request description
  • cb type description

Returns type description