Giter Site home page Giter Site logo

homebridge-nodemcu-relay's Introduction

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

Diagram

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

homebridge-nodemcu-relay's People

Contributors

flatout73 avatar karanprime avatar phenotypic avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.