Make ESP8266 use LittleFS instead of deprecated SPIFFS Make framework use the correct filesystem automatically and handle the call the FS.begin() Change default MQTT keepalive to 60 seconds Fix lodash security issue
37 lines
1.0 KiB
C++
37 lines
1.0 KiB
C++
#include <ESP8266React.h>
|
|
#include <LightMqttSettingsService.h>
|
|
#include <LightStateService.h>
|
|
|
|
#define SERIAL_BAUD_RATE 115200
|
|
|
|
AsyncWebServer server(80);
|
|
ESP8266React esp8266React(&server);
|
|
LightMqttSettingsService lightMqttSettingsService =
|
|
LightMqttSettingsService(&server, esp8266React.getFS(), esp8266React.getSecurityManager());
|
|
LightStateService lightStateService = LightStateService(&server,
|
|
esp8266React.getSecurityManager(),
|
|
esp8266React.getMqttClient(),
|
|
&lightMqttSettingsService);
|
|
|
|
void setup() {
|
|
// start serial and filesystem
|
|
Serial.begin(SERIAL_BAUD_RATE);
|
|
|
|
// start the framework and demo project
|
|
esp8266React.begin();
|
|
|
|
// load the initial light settings
|
|
lightStateService.begin();
|
|
|
|
// start the light service
|
|
lightMqttSettingsService.begin();
|
|
|
|
// start the server
|
|
server.begin();
|
|
}
|
|
|
|
void loop() {
|
|
// run the framework's loop function
|
|
esp8266React.loop();
|
|
}
|