Giter Site home page Giter Site logo

esp8266-controller's Introduction

ESP8266-controller

This software is intended as a generic framework for controlling an ESP8266 module.
The framework does nothing fancy by itself.

What does it do?

The framework supports the following:

  • Connect to a WiFi network
  • Sync to UTC time
  • Connect to a MQTT broker
  • Publish alive messages with some usefull(?) information
  • Subscribes to MQTT topics and decodes requests
  • Perform basic IO operations

How to use

Requirements

This SW uses PubSubClient for MQTT communication.
The default value of MQTT_MAX_PACKET_SIZE defined in pubsubclient.h is 128. This means that the maximum size of the mqtt header and payload is 128 bytes. Too allow larger payloads, this value must be modified to suit your own needs.

This SW uses NtpClient for UTC timesync. This will be made optional later.

Modify the code

In the esp8266-controller.ino file, modify the following:
NETWORK_SSID - Set to your wanted SSID
NETWORK_PASSWORD - Set to your prefered password
MQTT_SERVER - IP of MQTT broker to connect to
MQTT_TOPIC_STATUS_BASE - Base topic this software will publish info to
MQTT_TOPIC_SUBSCRIBE - Topic to subscribe to

Modify the function configurePinIO() in the same file. This function configures the allowed IO pins and their properties.

Upload the program using your preferred method.

Communicate using MQTT

You should shortly after boot (given that the SSID is correct and the application is able to connect to the MQTT broker) see a message in the /alive topic with parent topic defined by MQTT_TOPIC_STATUS_BASE.

Send a message to the the subscribed MQTT topic defined by MQTT_TOPIC_SUBSCRIBE.
The message syntax is command;pin;waittime
An example is ToggleOnOff;4;500.
This means Toggle pin number 4 on, wait for 500ms, then toggle pin number 4 off.

The response will be given in the /response topic under the parent defined by MQTT_TOPIC_STATUS_BASE. The reponse contains the command, a boolean status and a string describing what happened.

Supported commands

This is the currently supported commands. If you miss something, implement or make a request :-).

ToggleOnOff

Toggle a pin high for a given amount of time.

esp8266-controller's People

Contributors

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