Arduino code for ESP8266 on Homy development board to communicate with Mycroft through the ESP8266 Skill.
Communication protocol implemented :
- http GET request
- Websocket
- MQTT
Arduino libreries needed :
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <ESP8266HTTPUpdateServer.h>
#include <WebSocketsServer.h>
#include <PubSubClient.h>
#include <ArduinoJson.h>
#include <Wire.h>
#include "Adafruit_SHT31.h"
To use JSON message, I had to change from
#define MQTT_MAX_PACKET_SIZE 128
to
#define MQTT_MAX_PACKET_SIZE 512
in PubSubClient.h
.
- Implement SPIFFS to get access to the flash memory and used to store HTML, CSS and JavaScript files.
- Implement ArduinoOTA.
- Use Mycroft Skill to set or reset the MQTT server or MQTT topic.
- Improve security.