Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
80ba3e7
fix(definitions): write only validated, lint-clean definitions from t…
hjdhjd Nov 28, 2026
3cb15bf
feat(tlv): read and write 64-bit integers as bigint
hjdhjd Nov 28, 2026
e5b2db2
feat(characteristic): add the transient and sensitive props flags, wh…
hjdhjd Nov 28, 2026
b902460
feat: raise the engine floor to Node 22.20 with the disposable stacks…
hjdhjd Nov 28, 2026
d24410a
fix(datastream): end a destroyed data stream server for good, releasi…
hjdhjd Nov 28, 2026
46bcc43
feat(definitions): add the camera services and characteristics for ti…
hjdhjd Nov 28, 2026
303ce79
feat(camera): add the TLV8 codecs of the camera characteristics over …
hjdhjd Nov 28, 2026
193a6b1
feat(camera): add the camera diagnostics and the session plane every …
hjdhjd Nov 28, 2026
589ad7a
feat(camera): add the modern camera's options and its own services: o…
hjdhjd Nov 28, 2026
a544933
feat(camera): add the media primitives: the fragmented MP4 reader and…
hjdhjd Nov 28, 2026
3cc99e7
feat(camera): add the recording that provisions a camera and uploads …
hjdhjd Nov 28, 2026
8403863
feat(camera): add each video sensor's tier table, pacing every tier's…
hjdhjd Nov 28, 2026
70e2b26
feat(camera): stream live views at home through each video sensor's m…
hjdhjd Nov 28, 2026
b6fa920
feat(camera): stream live views from away through each video sensor's…
hjdhjd Nov 28, 2026
d85cb25
feat(camera): compose every camera, legacy and modern, in the camera …
hjdhjd Nov 28, 2026
cbbfeff
feat(examples): add a runnable camera example in the modern form, wit…
hjdhjd Nov 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ HAP-NodeJS is not an Apple certified HAP implementation, as this is only availab
npm install @homebridge/hap-nodejs
```

HAP-NodeJS needs Node.js `^22.12.0 || ^24 || ^26`.
HAP-NodeJS needs Node.js `^22.20.0 || ^24 || ^26`.

The package is an ES module. Importing it works as usual, including `import hap from '@homebridge/hap-nodejs'`.
CommonJS code can still `require('@homebridge/hap-nodejs')` on the Node.js versions above.
Expand All @@ -46,6 +46,12 @@ There is also a pretty detailed guide on [how to start developing with HAP-NodeJ
Or you may just have a look at our [examples][examples-repo] repository
(or some of the old [accessory examples][example-accessories]).

The example camera in `src/accessories/ModernCamera_example.ts` streams and records ffmpeg's test pattern with the camera features Apple introduced with iOS 27.
It needs ffmpeg with `libx265` and `libopus`: run `npm run build`, then `node dist/accessories/ModernCamera_example.js`, and add it with the setup code it prints.

Two guides cover those camera features. [Upgrading a Camera Plugin to HAP-NodeJS 2.4](guides/UpgradingCameraPlugins.md) is for plugin authors: what changed in the library and how a camera takes the new features.
[HomeKit Cameras in iOS 27](guides/HKSV3Protocol.md) describes the features themselves and how a home hub behaves around them.

The API documentation can be found [here](https://developers.homebridge.io/hap-nodejs/).

See the FAQ on how to enable [debug output][faq-debug] for HAP-NodeJS.
Expand Down
99 changes: 99 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ export default antfu(
'new-cap': 'off',
// HAP-NodeJS has no logger of its own; the console is where its warnings are meant to go
'no-console': 'off',
// The disposal stack globals arrive with Node 24 and the library shares its process with every plugin, which is why every site imports the internal stacks by
// name. The preset's own restrictions stay beside them, because this entry replaces its list.
'no-restricted-globals': [
'error',
{ message: 'Use `globalThis` instead.', name: 'global' },
{ message: 'Use `globalThis` instead.', name: 'self' },
{ message: 'Import DisposableStack from src/lib/util/disposableStack.ts, because Node 22 has no such global.', name: 'DisposableStack' },
{ message: 'Import AsyncDisposableStack from src/lib/util/asyncDisposableStack.ts, because Node 22 has no such global.', name: 'AsyncDisposableStack' },
{ message: 'Import SuppressedError from src/lib/util/disposableStack.ts, because Node 22 has no such global.', name: 'SuppressedError' },
],
'no-undef': 'error',
'perfectionist/sort-exports': 'error',
'perfectionist/sort-imports': [
Expand Down Expand Up @@ -85,6 +95,16 @@ export default antfu(
'perfectionist/sort-named-imports': 'off',
},
})
.append({
// A code sample in a guide shows a few lines of a plugin: the names around them are the reader's own, and its lines are laid out to be read.
files: ['guides/**/*.md/**'],
rules: {
'antfu/reasonable-newline': 'off',
'no-undef': 'off',
'node/prefer-global/buffer': 'off',
'unused-imports/no-unused-vars': 'off',
},
})
.append({
files: ['src/**/*.spec.ts'],
rules: {
Expand Down Expand Up @@ -139,3 +159,82 @@ export default antfu(
'test/valid-title': 'error',
},
})
.append({
// The number-based 64-bit helpers lose precision above 2^53, which is why none of these modules reaches them: the Camera Capabilities codecs carry every uint64 wire
// value as a bigint, the MP4 box readers carry decode times as bigints, the recording modules carry sequence numbers, key numbers and session identifiers
// as bigints, the camera session helpers hold the sessions that carry those values, the SRTP context keeps its packet index exact as Numbers and reaches
// none of these helpers, the multi-tier stream management carries every session value as a Number or a Buffer and reaches no number-based 64-bit helper,
// the WebRTC stream management hands SFrame key IDs to its delegate as the bigints the codecs decode, the DER writer takes every INTEGER as a bigint, the
// NTP conversion answers its 64-bit fixed-point time as a bigint, and the recording provisioning record keeps the Camera Key's number and its high-water
// marks as bigints.
files: [
'src/lib/camera/capabilities/**/*.ts',
'src/lib/camera/mp4/**/*.ts',
'src/lib/camera/recording/**/*.ts',
'src/lib/camera/session/**/*.ts',
'src/lib/camera/srtp/**/*.ts',
'src/lib/camera/MultiTierStreamManagement.ts',
'src/lib/camera/WebRTCStreamManagement.ts',
'src/lib/util/der.ts',
'src/lib/util/ntp.ts',
'src/lib/model/RecordingProvisioning.ts',
],
rules: {
'no-restricted-imports': [
'error',
{
patterns: [
{
regex: '(?:^|/)util/tlv\\.js$',
importNames: ['readUInt64LE', 'readVariableUIntLE', 'writeVariableUIntLE'],
message: 'Read and write 64-bit integers as bigint through readBigUInt64LE and writeBigUInt64LE.',
},
{
regex: '(?:^|/)util/hapCrypto\\.js$',
importNames: ['writeUInt64LE'],
message: 'Write 64-bit integers as bigint through writeBigUInt64LE from tlv.js.',
},
{
regex: '(?:^|/)util/time\\.js$',
importNames: ['epochMillisFromMillisSince2001_01_01Buffer'],
message: 'Read 64-bit integers as bigint through readBigUInt64LE from tlv.js.',
},
{
regex: '(?:^|/)datastream/(?:index|DataStreamParser)\\.js$',
importNames: ['Int64'],
message: 'Carry 64-bit integers as bigint, which Int64 cannot hold exactly.',
},
],
},
],
},
})
.append({
// A constant set and the type derived from it share one name in the capability codecs, which this rule reads as a redeclaration.
files: ['src/lib/camera/capabilities/**/*.ts'],
rules: {
'ts/no-redeclare': 'off',
},
})
.append({
files: ['package.json'],
rules: {
// npm reads `files` in order and a negated entry keeps a file out only when it comes after the entry it narrows, which is why negated entries come last.
'jsonc/sort-array-values': [
'error',
{
order: [
{
order: { type: 'asc' },
valuePattern: '^[^!]',
},
{
order: { type: 'asc' },
valuePattern: '^!',
},
],
pathPattern: '^files$',
},
],
},
})
Loading
Loading