Giter Site home page Giter Site logo

rawaarajab / esp8266relaymanager Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jonathanendersby/esp8266relaymanager

0.0 0.0 0.0 13 KB

A simple 2 channel, web and REST API, relay manager for the ESP8266 with WifiManager.

License: GNU General Public License v2.0

Arduino 100.00%

esp8266relaymanager's Introduction

ESP8266RelayManager

A simple 2 channel relay manager for the ESP8266 with a web inteface and API.

I use this with an ESP8266-01 and a relay board similar to http://modtronix.com/mod-rly2-5v.html. This uses https://github.com/tzapu/WiFiManager which you'll need to install by following their instructions.

How to configure

Because this uses the wonderful WifiManager project, when you first power the ESP up it will not know how to connect to your network, and instead it will create a Wifi AP that you can connect and then give it the details for your network. If at any point in the future it fails to connect to your wifi (eg. you change your password) it will go back into AP mode so that you can configure it again.

I've set mine up to connect to the wifi and then start hosting the web server on 192.168.0.20. Make that IP something outside of your DHCP range.

If you're not using the ESP8266-01 you will probably need to change the pin configurations.

Using the Web Interface

Open your browser to http://192.168.0.20/ and you should get a pretty self explanatory interface with two buttons.

Using the API

The API is RESTful so expects you to use GET and POST. It returns JSON.

HTTP GET to read the relay state

GET http://192.168.0.20/api/relay1 returns an HTTP 200 and :

{
  "state": 1
}

1 = Relay is on. 0 = Relay is off.

HTTP POST to set the relay state.

POST http://192.168.0.20/api/relay2 with a POST form variable called state and it's value set to 0 or 1 (on or off).

You'll receive a response like:

{
  "state": 1,
  "set": 1
}

Where state=1 means the relay is on, and set=1 means you've just set it that way.

Notes

esp8266relaymanager's People

Contributors

jonathanendersby 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.