This is a
playground to test code. It runs a full
Node.js environment and already has all of
npm’s 400,000 packages pre-installed, including
homebridge-plugin-wrapper with all
npm packages installed. Try it out:
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.
A wrapper to use Homebridge plugins without big dependecies in own projects
Homebridge is a great project with currently 1200 available plugins and many active developers that provide integrations for many IoT devices.
So the idea was to allow other Node-JS based projects to use the work done by all the Homebridge-Plugin developers in their projects. First of all I use it for ioBroker (https://iobroker.net).
This project contains copies and slightly changed files from Homebridge and HAP-NodeJS and only minimal dependecies. Especially the whole MDNS and Encryption stuff is not included because using the Wrapper is not publishing the bridge (because not needed).
The wrapper also uses the great "mock-require" module to further minimize dependencies for modules that are not needed in this usage. But this has a side-effect!! The following modules are not usable in your projects currently:
In the example folder you find a very easy example. For this to work please install homebridge-sun-position to your testing directory to get the needed plugin. Then you can start the example via node example.js and it outputs all available characteristics. The example file also contain an example how to get and set a value.
Basically you create an object instance and providing a configuration object to the constructor. The configuration needs to have:
See the example file.
After that you can register to the following events:
To really start you call init method and at the end finish to clean up.
The example contains code how to get and set values.
This Wrapper is based on the outstanding work and code from the following projects:
This project uses copies of most of the code from both projects tp provide the functionality