All Projects → tuanpmt → Esp_mqtt

tuanpmt / Esp_mqtt

Licence: mit
MQTT client library for ESP8266

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Esp mqtt

Home Assistant Config
My Home Assistant Configuration 🏡🏡
Stars: ✭ 133 (-87.3%)
Mutual labels:  mqtt, iot, esp8266
Blynk Server
Blynk is an Internet of Things Platform aimed to simplify building mobile and web applications for the Internet of Things. Easily connect 400+ hardware models like Arduino, ESP8266, ESP32, Raspberry Pi and similar MCUs and drag-n-drop IOT mobile apps for iOS and Android in 5 minutes
Stars: ✭ 8 (-99.24%)
Mutual labels:  mqtt, iot, esp8266
Blinker Doc
blinker中文文档
Stars: ✭ 139 (-86.72%)
Mutual labels:  mqtt, iot, esp8266
Esp8266 aliyun mqtt app
基于ESP8266官方SDK快速接入阿里云物联网平台
Stars: ✭ 81 (-92.26%)
Mutual labels:  mqtt, iot, esp8266
Tasmota
Alternative firmware for ESP8266 with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
Stars: ✭ 16,624 (+1487.77%)
Mutual labels:  mqtt, iot, esp8266
Awtrix1.0
(Outdated) Smart RGB Matrix Clock
Stars: ✭ 99 (-90.54%)
Mutual labels:  mqtt, iot, esp8266
Espmqttclient
Wifi and MQTT handling for ESP8266 and ESP32
Stars: ✭ 169 (-83.86%)
Mutual labels:  mqtt, iot, esp8266
Homie Esp8266
💡 ESP8266 framework for Homie, a lightweight MQTT convention for the IoT
Stars: ✭ 1,241 (+18.53%)
Mutual labels:  mqtt, iot, esp8266
Pjon
PJON (Padded Jittering Operative Network) is an experimental, arduino-compatible, multi-master, multi-media network protocol.
Stars: ✭ 2,615 (+149.76%)
Mutual labels:  mqtt, iot, esp8266
Wthermostatbeca
Replaces original Tuya firmware on Beca thermostat with ESP8266 wifi module
Stars: ✭ 204 (-80.52%)
Mutual labels:  mqtt, iot, esp8266
Blinker Library
An IoT Solution,Blinker library for embedded hardware. Works with Arduino, ESP8266, ESP32.
Stars: ✭ 1,095 (+4.58%)
Mutual labels:  mqtt, iot, esp8266
Esphome
ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems.
Stars: ✭ 4,324 (+312.99%)
Mutual labels:  mqtt, iot, esp8266
Temper Esp8266
Temper is a compact temperature sensor based on ESP8266 and SHT30 with large 13x7 pixel led display.
Stars: ✭ 155 (-85.2%)
Mutual labels:  mqtt, iot, esp8266
Esp8266 React
A framework for ESP8266 & ESP32 microcontrollers with a React UI
Stars: ✭ 193 (-81.57%)
Mutual labels:  mqtt, iot, esp8266
Tuya Convert
A collection of scripts to flash Tuya IoT devices to alternative firmwares
Stars: ✭ 3,338 (+218.82%)
Mutual labels:  mqtt, iot, esp8266
Sonoff Homeassistant
Firmware for ESP8266 based itead Sonoff switches for use with HomeAssistant
Stars: ✭ 354 (-66.19%)
Mutual labels:  mqtt, iot, esp8266
Wavin Ahc 9000 Mqtt
Esp8266 mqtt interface for Wavin AHC-9000/Jablotron AC-116
Stars: ✭ 47 (-95.51%)
Mutual labels:  mqtt, esp8266
Rf24node msgproto
An application that runs on a Raspberry Pi that interfaces RF24Network packets to a Message Bus. Currently MQTT & AMQP (alpha); Topics are RF24SensorNet compatible.
Stars: ✭ 11 (-98.95%)
Mutual labels:  mqtt, iot
Aedes
Barebone MQTT broker that can run on any stream server, the node way
Stars: ✭ 1,007 (-3.82%)
Mutual labels:  mqtt, iot
Mqtt
Native Go MQTT Library
Stars: ✭ 15 (-98.57%)
Mutual labels:  mqtt, iot

esp_mqtt

This is MQTT client library for ESP8266, port from: MQTT client library for Contiki (thanks)

Features:

  • Support subscribing, publishing, authentication, will messages, keep alive pings and all 3 QoS levels (it should be a fully functional client).
  • Support multiple connection (to multiple hosts).
  • Support SSL connection
  • Easy to setup and use

Prerequire:

Compile:

  • Copy file include/user_config.sample.h to include/user_config.local.h and change settings, included: SSID, PASS, MQTT configurations ...

Make sure to add PYTHON PATH and compile PATH to Eclipse environment variable if using Eclipse

git clone --recursive https://github.com/tuanpmt/esp_mqtt
cd esp_mqtt
#clean
make clean
#make
make SDK_BASE=/tools/esp8266/sdk/ESP8266_NONOS_SDK ESPTOOL=tools/esp8266/esptool/esptool.py all
#flash
make ESPPORT=/dev/ttyUSB0 flash

Usage

See file: user/user_main.c

Notes

  • The client id needs to be unique. If not, When there are more than 2 clients use the same ClientID, the following logged-in client will kick the ahead logged-in client, and so on forever

Publish message and Subscribe

/* TRUE if success */
BOOL MQTT_Subscribe(MQTT_Client *client, char* topic, uint8_t qos);

BOOL MQTT_Publish(MQTT_Client *client, const char* topic, const char* data, int data_length, int qos, int retain);

Already support LWT: (Last Will and Testament)

/* Broker will publish a message with qos = 0, retain = 0, data = "offline" to topic "/lwt" if client don't send keepalive packet */
MQTT_InitLWT(&mqttClient, "/lwt", "offline", 0, 0);

Default configuration

See: include/user_config.sample.h

Define protocol name in include/user_config.local.h

#define PROTOCOL_NAMEv31	/*MQTT version 3.1 compatible with Mosquitto v0.15*/
//PROTOCOL_NAMEv311			/*MQTT version 3.11 compatible with https://eclipse.org/paho/clients/testing/*/

Create SSL Self sign

openssl req -x509 -newkey rsa:1024 -keyout key.pem -out cert.pem -days XXX

SSL Mqtt broker for test

var mosca = require('mosca')
var SECURE_KEY = __dirname + '/key.pem';
var SECURE_CERT = __dirname + '/cert.pem';
var ascoltatore = {
  //using ascoltatore
  type: 'mongo',
  url: 'mongodb://localhost:27017/mqtt',
  pubsubCollection: 'ascoltatori',
  mongo: {}
};

var moscaSettings = {
  port: 1880,
  stats: false,
  backend: ascoltatore,
  persistence: {
    factory: mosca.persistence.Mongo,
    url: 'mongodb://localhost:27017/mqtt'
  },
  secure : {
    keyPath: SECURE_KEY,
    certPath: SECURE_CERT,
    port: 1883
  }
};

var server = new mosca.Server(moscaSettings);
server.on('ready', setup);

server.on('clientConnected', function(client) {
    console.log('client connected', client.id);
});

// fired when a message is received
server.on('published', function(packet, client) {
  console.log('Published', packet.payload);
});

// fired when the mqtt server is ready
function setup() {
  console.log('Mosca server is up and running')
}

Example projects using esp_mqtt:

MQTT Broker for test

MQTT Client for test

Contributing:

Feel free to contribute to the project in any way you like!

Authors: Tuan PM

LICENSE - "MIT License"

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].