MCPcopy Index your code
hub / github.com/homebridge/HAP-NodeJS

github.com/homebridge/HAP-NodeJS @v2.1.7

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.1.7 ↗ · + Follow
2,254 symbols 4,862 edges 106 files 159 documented · 7% 3 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

HAP-NodeJS

Coverage Status

HAP-NodeJS is an implementation of the HomeKit Accessory Server as specified in the HomeKit Accessory Protocol (HAP), which is defined by Apple as part of the HomeKit Framework.

HAP-NodeJS is intended to be used as a library to easily create your own HomeKit Accessory on a Raspberry Pi, Intel Edison, or any other platform that can run Node.js :)
If you are searching for a pluggable HomeKit bridge with over a thousand community driven plugins to bring HomeKit support to devices which do not support HomeKit out of the box, you may want to look at the homebridge project (which also uses HAP-NodeJS internally).

The implementation tries to follow the HAP specification as close as it can, but may differ in some cases. HAP-NodeJS is not an Apple certified HAP implementation, as this is only available to members of the MFi program.

Getting started

You may start by having a look at our Wiki, especially have a look at the Important HomeKit Terminology used in this project.

There is also a pretty detailed guide on how to start developing with HAP-NodeJS. Or you may just have a look at our examples repository (or some of the old accessory examples).

The documentation (WIP) can be found here.

See the FAQ on how to enable debug output for HAP-NodeJS.

Projects based on HAP-NodeJS

  • Homebridge - HomeKit support for the impatient - Pluggable HomeKit Bridge.
    Plugins available for e.g. Pilight, Telldus TDtool, Savant, Netatmo, Open Pixel Control, HomeWizard, Fritz!Box, LG WebOS TV, Home Assistant, HomeMatic and many more.
  • OpenHAB-HomeKit-Bridge - OpenHAB HomeKit Bridge bridges openHAB items to Apples HomeKit Accessory Protocol.
  • homekit2mqtt - HomeKit to MQTT bridge.
  • pimatic-hap - Pimatic homekit bridge.
  • node-red-contrib-homekit - Node-RED nodes to simulate Apple HomeKit devices.
  • ioBroker.homekit - connect ioBroker to HomeKit.
  • AccessoryServer - HomeKit integration for IR/RF/IP-devices

Notes

Special thanks to Alex Skalozub, who reverse-engineered the server side HAP. ~~You can find his research here.~~ (Sadly, on Nov 4 2014, Apple sent the DMCA request to GitHub to remove the research.)

There is a video demo running this project on Intel Edison.

If you are interested in HAP over BTLE, you might want to check this.

Extension points exported contracts — how you extend this code

CameraStreamingDelegate (Interface)
(no doc) [6 implementers]
src/lib/controller/CameraController.ts
CharacteristicJsonObject (Interface)
(no doc)
src/types.ts
EventNotification (Interface)
(no doc)
src/internal-types.ts
InitOptions (Interface)
(no doc)
src/types/node-persist.d.ts
PairVerifyM2 (Interface)
(no doc)
src/test-utils/PairVerifyClient.ts
MP4Atom (Interface)
(no doc)
src/accessories/Camera_accessory.ts
SerializableController (Interface)
(no doc) [5 implementers]
src/lib/controller/Controller.ts
ServiceJsonObject (Interface)
(no doc)
src/types.ts

Core symbols most depended-on inside this repo

getCharacteristic
called by 276
src/lib/Service.ts
getDefaultValue
called by 262
src/lib/Characteristic.ts
addOptionalCharacteristic
called by 242
src/lib/Service.ts
testCharacteristic
called by 230
src/lib/Service.ts
addCharacteristic
called by 179
src/lib/Service.ts
encode
called by 147
src/lib/datastream/DataStreamParser.ts
on
called by 131
src/lib/Service.ts
push
called by 130
src/lib/datastream/DataStreamParser.ts

Shape

Method 1,069
Class 778
Enum 145
Function 145
Interface 117

Languages

TypeScript100%

Modules by API surface

src/lib/definitions/CharacteristicDefinitions.ts750 symbols
src/lib/definitions/ServiceDefinitions.ts219 symbols
src/lib/datastream/DataStreamParser.ts105 symbols
src/lib/controller/RemoteController.ts92 symbols
src/lib/Accessory.ts73 symbols
src/lib/camera/RTPStreamManagement.ts72 symbols
docs/assets/main.js68 symbols
src/lib/util/eventedhttp.ts61 symbols
src/lib/Advertiser.ts61 symbols
src/lib/datastream/DataStreamServer.ts60 symbols
src/lib/controller/AdaptiveLightingController.ts60 symbols
src/lib/camera/RecordingManagement.ts58 symbols

For agents

$ claude mcp add HAP-NodeJS \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page