# homebridge-lib

> Library for homebridge plugins

Latest version **8.1.5** (published 2026-08-29) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install homebridge-lib
pnpm add homebridge-lib
yarn add homebridge-lib
bun add homebridge-lib
```

Provides the commands `hap`, `json`, `upnp`, `sysinfo`.

## Health

**Score 60/100 (C)** — status: active.

Positive: esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 8.1.5 |
| Published | 2026-08-29 |
| First published | 2017-03-17 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | 24.20.0\|\|^24\|\|^22 |
| Dependencies | 2 |
| Unpacked size | 238.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 94 |
| Author | Erik Baauw |
| Maintainers | ebaauw |
| Keywords | homekit, homebridge |

## Links

- npm: https://www.npmjs.com/package/homebridge-lib
- Repository: https://github.com/ebaauw/homebridge-lib
- Homepage: https://github.com/ebaauw/homebridge-lib#readme
- Issues: https://github.com/ebaauw/homebridge-lib/issues
- npm.io page: https://npm.io/package/homebridge-lib

## Dependencies (2)

- [hb-lib-tools](https://npm.io/package/hb-lib-tools.md) ~3.0.11
- [@homebridge/plugin-ui-utils](https://npm.io/package/@homebridge/plugin-ui-utils.md) ~2.2.6

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 8.1.5 (latest) — 2026-08-29
- 8.0.0-1 (beta) — 2026-04-08
- 8.1.4 — 2026-08-04
- 8.1.3 — 2026-07-12
- 8.1.2 — 2026-06-27
- 8.1.1 — 2026-06-07
- 8.1.0 — 2026-05-06
- 8.0.1 — 2026-05-04
- 8.0.0 — 2026-04-13
- 8.0.0-0 — 2026-04-03
- 7.3.2 — 2026-03-13
- 7.3.1 — 2026-02-11
- 7.3.0 — 2026-01-21
- 7.2.2 — 2026-01-10
- 7.2.1 — 2026-01-09
- … 248 more at https://npm.io/package/homebridge-lib/versions

## README

<p align="center">
  <img src="homebridge-lib.png" height="200px">  
</p>
<span align="center">

# Homebridge Lib
[![Downloads](https://img.shields.io/npm/dt/homebridge-lib.svg)](https://www.npmjs.com/package/homebridge-lib)
[![Version](https://img.shields.io/npm/v/homebridge-lib.svg)](https://www.npmjs.com/package/homebridge-lib)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![GitHub issues](https://img.shields.io/github/issues/ebaauw/homebridge-lib)](https://github.com/ebaauw/homebridge-lib/issues)
[![GitHub pull requests](https://img.shields.io/github/issues-pr/ebaauw/homebridge-lib)](https://github.com/ebaauw/homebridge-lib/pulls)

</span>

## Library for Homebridge Plugins
Copyright © 2018-2026 Erik Baauw. All rights reserved.

While developing a number of [Homebridge](https://github.com/homebridge/homebridge) plugins, I find myself duplicating a lot of code.
The idea behind this library is to ease developing and maintaining Homebridge plugins by separating this generic code, dealing with [HomeKit](http://www.apple.com/ios/home/) and Homebridge, from the specific code, dealing with the actual devices being exposed to HomeKit.

### Documentation
The documentation, how to develop a plugin using Homebridge Lib, is provided in the code and through tutorials in the `doc` directory.
To generate the documentation, install [`jsdoc`](https://github.com/jsdoc3/jsdoc) and run `jsdoc -c jsdoc.json`.
To view the documentation, open `index.html` in the `out` directory.  

See [Homebridge WS](https://github.com/ebaauw/homebridge-ws) for an example plugin based on Homebridge Lib.

### Command-Line Tools
The Homebridge Lib library comes with a number of command-line tools for troubleshooting Homebridge installations.

Tool      | Description
--------- | -----------
`hap`     | Logger for HomeKit accessory announcements.
`json`    | JSON formatter.
`sysinfo` | Print hardware and operating system information.
`upnp`    | UPnP tool.

Each command-line tool takes a `-h` or `--help` argument to provide a brief overview of its functionality and command-line arguments.

### Installation
This library is _not_ a Homebridge plugin and does not need to be installed manually.
Instead, Homebridge plugins using this library should list it as a dependency in their `package.json`.
This way, `npm` installs Homebridge Lib automatically when installing the actual plugin.

To install the command-line tools, use:
```
$ sudo npm -g i hb-lib-tools
```
This creates symlinks to these tools in `/usr/bin` or `/usr/local/bin` (depending on how you installed NodeJS).

### Credits
The logic for handling [Eve](https://www.evehome.com/en/eve-app) history was copied from Simone Tisa's [`fakegato-history`](https://github.com/simont77/fakegato-history) repository, copyright © 2017 simont77.

### Caveats
Homebridge Lib is a hobby project of mine, provided as-is, with no warranty whatsoever.  I've been running it successfully at my home for years, but your mileage might vary.

---
_Source: https://npm.io/package/homebridge-lib · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
