×

homebridge示例插件示例集合

消耗积分:0 | 格式:zip | 大小:0.08 MB | 2022-04-21

王玉兰

分享资料个

授权协议 Readme
开发语言 JavaScript
操作系统 跨平台
软件类型 开源软件
所属分类 其他开源物联网

软件简介

homebridge-examples

This repo bundles some example implementations for homebridge plugins. They provide some example code to get started with. They are also published on npm like regular plugins, so you can easily run them in your local homebridge instance. Refer to the respective package.json for the plugin name and install them as usual.

The examples are all written in Typescript and thus require at least homebridge v1.0.0.
To build a plugin run the following commands in the respective plugin directory.

Run this command once to install all dependencies required by the plugin:

npm install

After that run the following command to compile the Typescript files into Javascript (repeat this step every time you change something in the code).

npm run build

If you need inspiration for a plugin written in Javascript you can just run the above commands and look at the generated Javascript code located in the ./dist folder. You may need to ignore some code at the beginning of the file generated by the Typescript compiler.

Examples for different homebridge plugin types

Accessory Plugins

Accessory plugins are the most basic and simplest plugins for homebridge. They should be used if you only want to expose a single accessory and don't require any special functionality.

Platform Plugins:

Platform plugins are able to expose multiple accessories. Additionally, they are required if you want to use the Controller API.

  • Static Platform Plugin: Static platforms know which accessories they want to expose on start up. The set of accessories cannot change over the lifespan of the plugin.
  • Dynamic Platform Plugin: Dynamic platforms can dynamically add or remove accessories at runtime. Accessories are fully stored to disk by homebridge, and the exact state is reconstructed on a reboot. The plugin can store additional context as well.
  • Independent Platform Plugin: Independent platforms are typically used when the platform intends to only expose external accessories or provides other functionality while not exposing an accessory at all.

Other example plugins

 

声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉

评论(0)
发评论

下载排行榜

全部0条评论

快来发表一下你的评论吧 !