GithubHelp home page GithubHelp logo

esprflinkmqtt's Introduction

espRFLinkMQTT

ESP8266 gateway between RFLink and MQTT server

This code allows to use an ESP8266 (ESP01, D1 mini, ...) to forward data from an RFLink board to an MQTT server with messages in JSON.

Code is inspired from rflink-to-mqtt, RflinkToJsonMqtt and RFLink-to-FHEM-via-MQTT

The following capabilities were added:

  • MQTT username, password and will topic
  • Adds a new unique field if a CMD field follows a SWITCH field (ex: "SWITCH02" = "ON" added to "SWITCH"="02", CMD="ON")
  • Hardware reset RFLink MEGA with ESP pin
  • Auto reset RFLink MEGA if no data is received within a specific time frame (disabled by default, set RESET_MEGA_INTERVAL in ms to enable)
  • HTTP server to show data received and how it is converted, with javascript functions to filter or sort colum by clicking on headers (Live data tab only)
  • Debug mode to publish on MQTT server with possibility to enable/disable
  • Uptime published on MQTT server every 5 minutes
  • OTA firmware update from webserver
  • Send commands from web interface with possibility to setup a predefined user list
  • Change easily serial interface to be used : hardware serial RX/TX, software serial on user defined pins, or a mix ; by default it listens to RFLink MEGA on ESP RX pin and writes to RFLink MEGA on ESP TX
  • Handles negative values for fields TMP, WINCHL, WINTMP
  • Handles HUM as an integer
  • Check data received is ASCII
  • Possibility to publish only a list of user IDs to MQTT server. In addition, possibility to publish only on data change but still to publish after a user defined time frame (disabled by default - change USER_ID_NUMBER and USER_IDs to enable). Possibility as well to defined a different ID to be published (usefull when a device gets a new ID after battery change)
  • Possibility to force a specific ID for devices changing frequently ; it applies to a specific name/protocol, which means there should be only one device around using this protocol (change USER_SPECIFIC_IDs)
  • Show setup information on web interface plus last received / published time for each defined USER ID
  • Use of ESP Easy CSS for nice web interface

Setup:

  • RFLink-Hardware required (official or DIY)
  • Edit options in config.h
    • Serial and hardware configuration
    • Wi-Fi and MQTT settings
    • Update USER_IDs table with your own devices if you want to use ID filtering
    • Change USER_ID_NUMBER with the number of USER_IDs table lines
    • Modify USER_CMDs table to show you own commands on the web interface
  • Compile with Arduino IDE - You will need the following libraries:
    • ArduinoJson library 5.13.x, not version 6.x.x (Sketch > Include Library > Manage Librairies > ArduinoJson > Select version 5.13.x > Install)
    • PubSubClient
  • Upload to ESP
  • Wire serial as defined in serial configuration ; wire ESP RX pin to RFLink MEGA TX pin, and ESP TX pin to RFLINK MEGA RX pin (this is default, see note below to change it)
  • To handle hardware reset of RFLink MEGA from ESP, wire ESP GPIO/D3 pin to RFLink MEGA RST (this is default ; it can be changed with MEGA_RESET_PIN in config.h)
  • Subscribe to MQTT topic 'rflink/#'
  • Use web interface by pointing your http browser to ESP IP

How to use

When RFLink receives something this is presented on the serial line eg.:

20;2A;Xiron;ID=2801;TEMP=0043;HUM=29;BAT=OK;

This software publishes this to the topics:

rflink/Xiron-2801

as json like this:

{TEMP:"6.7",HUM:"29",BAT:"OK"};

How to send commands

MQTT

Publish the command according to the documentation to the topic

rflink/cmd

e.g.

10;NewKaku;01dd77d5;1;OFF;

Web interface

On the web interface main page, use the form or a predefined command button

alt tag

Watchout

Use it at your own risk!!!

esprflinkmqtt's People

Contributors

seb821 avatar

Watchers

James Cloos 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.