Skip to content

BrittonA/homebridge-nodemcu-relay

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 

Repository files navigation

homebridge-nodemcu-relay

GitHub last commit GitHub issues

Description

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, follow this gist which walks you through how to flash a NodeMCU using the Arduino IDE. The .ino file referred to is the NodeMCU-Relay.ino file included in this repository

  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/SWITCH=ON",
      "off_url": "http://relay.local/SWITCH=OFF",
      "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 IP address of your NodeMCU followed by the action you wish to execute.

Here is a table which shows you the available relay actions included with the NodeMCU-Relay.ino script in this repository which can be included in the config.json to control different types of appliances:

Name Full URLs Description Example Uses
Switch relay.local/SWITCH=ON relay.local/SWITCH=OFF Will simply turn on/off the relay permanently as per the Home app. Lights, Faucets, Fans
Momentary relay.local/MOMENTARY=ON relay.local/MOMENTARY=OFF Will activate the relay for a brief moment, then deactivate after the amount of time specified in the NodeMCU-Relay.ino script. Garages, Gates, Buzzers
Modulation relay.local/MODULATION=ON relay.local/MODULATION=OFF Will activate then deactivate the relay constantly for the amount of time specified in the NodeMCU-Relay.ino script until turned off. Lights, Sprinkler systems
State relay.local/status Will return current state as 0 or 1 N/A

About

Control a relay with Apple HomeKit

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 100.0%