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

phenotypic/homebridge-nodemcu-relay: Control a relay with Apple HomeKit

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

开源软件名称:

phenotypic/homebridge-nodemcu-relay

开源软件地址:

https://github.com/phenotypic/homebridge-nodemcu-relay

开源编程语言:

C++ 100.0%

开源软件介绍:

homebridge-nodemcu-relay

This script interfaces with homebridge to expose a relay to Apple's HomeKit, allowing you to integrate numerous devices into your smart home.

Requirements

  • NodeMCU

  • Relay Module

  • Pin header cables

  • Micro-USB cable

How-to

  1. First, install the ArduinoJson library from the Library manager in the Arduino IDE, then follow this gist which walks you through how to flash a NodeMCU.

  2. Assuming that you already have homebridge set up, the next thing you will have to do is install homebridge-http using the command:

npm install -g homebridge-http
  1. Finally, update your config.json file following the example below, making sure to adapt it accordingly:
"accessories": [
    {
      "accessory": "Http",
      "name": "Lights",
      "on_url": "http://relay.local/setState?type=switch&value=1",
      "off_url": "http://relay.local/setState?type=switch&value=0",
      "http_method": "GET"
    }
]

Wiring

NodeMCU Relay Module
3V3 VCC
GND GND
D7 IN1

Available Features

As you can see from the config.json example above, the basic format of the HTTP request is the declaration of the mode type followed by the required state:

http://relay.local/setState?type=STRING_VALUE&value=INT_VALUE

Here is a table which shows you the available queries:

Name Query Description Example Uses
Switch /setState?type=switch Will simply turn on/off the relay permanently as per the Home app. Lights, Faucets, Fans
Momentary /setState?type=momentary Will activate the relay for a brief moment, then deactivate after the amount of time specified in the script. Garages, Gates, Buzzers
Modulation /setState?type=modulation Will activate then deactivate the relay constantly for the amount of time specified in the script until turned off. Lights, Misting systems
State /status Will return the currentState in JSON form as 0 or 1 N/A



鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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