JSPM

  • Created
  • Published
  • Downloads 3094
  • Score
    100M100P100Q111844F
  • License Apache-2.0

Library for homebridge plug-ins

Package Exports

  • homebridge-lib

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (homebridge-lib) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

homebridge-lib

npm npm JavaScript Style Guide

Library for Homebridge Plugins

Copyright © 2018-2019 Erik Baauw. All rights reserved.

While developing a number of 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 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 and run jsdoc -c jsdoc.json. To view the documentation, open index.html in the out directory.

See 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.
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

Plugins based on homebridge-lib define this library as peer dependency, rather than a regular dependency. This way, homebridge-lib is loaded only once and shared across all plugins, similar to Homebridge itself. Note that as homebridge-lib isn't included in the plugin package, it must be installed separately, by issuing:

$ sudo npm -g i homebridge-lib

To allow homebridge-lib to be updated by homebridge-config-ui-x, it presents itself as a separate plugin to Homebridge. As it doesn't expose any HomeKit accessories, there is no configuration needed. It does need to be loaded, however. If you use the plugins key in config.json to specify what plugins to load, make sure to include homebridge-lib.

Credits

The logic for handling Eve history was copied from Simone Tisa's fakegato-history repository, copyright © 2017 simont77.