• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

krisbreuker/homebridge-gpio-onoff: GPIO plugin for Homebridge: https://github.co ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

krisbreuker/homebridge-gpio-onoff

开源软件地址:

https://github.com/krisbreuker/homebridge-gpio-onoff

开源编程语言:

JavaScript 100.0%

开源软件介绍:

Homebridge GPIO

Supports triggering General Purpose Input Output (GPIO) pins on platforms supporting the onoff package. It is based on homebridge-gpio, but using the onoff package instead of pi-gpio to be able to listen for changes in pin values.

Requirements

  • Homebridge - HomeKit support for the impatient
  • onoff - Reading and writing GPIO pins and listening for changes

Installation

  1. Install Homebridge using npm install -g homebridge
  2. Install this plugin npm install -g homebridge-gpio-onoff
  3. Update your configuration file

Configuration

Example config.json, creating a switch accessory that the user can switch on and off, setting the GPIO pin value to '1' or '0', respectively:

{
  "accessories": [
    {
      "accessory": "GPIO-OnOff",
      "name": "GPIO-7",
      "pin": 7,
      "direction": "out"
    }
  ]
}

accessory should be set to GPIO-OnOff for this plugin. name is the accessory's name, which is shown in HomeKit. pin is the physical GPIO pin number. direction can be set to either in to read from the GPIO pin or out to write to the pin. If set to in, the edge property can be set to rising, falling or both to have a changing GPIO pin value trigger an accessory value change (it is set to none by default).

By default, a simple 'Switch' accessory is created, which will be set to 'On' or 'Off' by a change in the input value. It is possible to change the service type and even the true and false values. For example, to have it act like a light sensor, you can specify:

{
  "accessories": [
    {
      "accessory": "GPIO-OnOff",
      "name": "GPIO-7",
      "pin": 7,
      "direction": "in",
      "edge": "both",
      "activeLow": true,
      "hapService": "LightSensor",
      "hapCharacteristic": "CurrentAmbientLightLevel",
      "trueValue": 100000,
      "falseValue": 0.0001
    }
  ]
}

activeLow will treat '0' as the true value and '1' as the false value. hapService can be set to one of the defined services in HomeKitTypes.js and hapCharacteristic to one of the characteristics defined for the service. If the characteristic values are not boolean, you can specify the values for true and false by setting trueValue and falseValue, respectively.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap