mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
3.5 KiB
3.5 KiB
Notes on customizing the code
Basic Design Principles
- The core services like telnet, logging and shell are based off the libraries from @nomis. I also adopted his general design pattens such as making everything as asynchronous as possible so that no one operation should starve another operation of it's time to execute (https://isocpp.org/wiki/faq/ctors#static-init-order).
- All EMS devices (e.g. boiler, thermostat, solar modules, mixing units etc) are derived from a factory base class and each class handles its own registering of telegram and mqtt handlers. This makes the EMS device code easier to manage and we can extend with new telegrams types and features.
- For debugging there is an offline mode where the code can be compiled and executed standalone without uploading to an ESP controller. Use
make(based off GNUMakefile).
Customizing the Web UI
The Web is based off Rick's awesome esp8266-react framework. These are the files that are modified:
interface:
.envproject name and project path to ems-esp.env.developmentCORS URL
interface/public:
app/manifest.jsonems-esp nameindex.htmlems-esp nameapp/icon.png256x256 PNGfavicon.icoreplaced
interface/src:
CustomMuiTheme.tsxcolors for dark modeinterface/src/wifi/WifiSettingsController.tsxrename esp8266-react
interface/src/project:
ProjectRouting.tsxremoved demo, added paths to ems-esp/status, ems-esp/settings and *DemoProject.tsxremove /demo/ and changed title, renamed to EMSESP.tsxProjectMenu.tsxtitle change, added /ems-esp/settingsDemoInformation.tsxremoved filetypes.tsadd variables- added all custom files starting with EMSESP*
interface/src/mqtt:
types.tsadded mqtt_failsMqttStatusForm.tsxadded MQTT Publish ErrorsMqttStatus.tsadded function mqttPublishHighlightMqttSettingsForm.tsxadded publish time, qos, format
interface/src/authentication:
AuthenticationWrapper.tsxcommented out features.security because we added versionAuthenticationContext.tsxadded versionMqttSettingsForm.tsxadded publish time, qos, format
interface/src/components:
MenuAppBar.tsxadded version to toolbar
interface/src/system:
types.tsadded uptime and free_memSystemStatusForm.tsxadded system uptime, % free mem
lib/framework:
SystemStatus.hadded #include <LittleFS.h>, #include <uuid/log.h>, #include "../../src/system.h"SystemStatus.cppadded LittleFS.info(fs_info); root["uptime"], root["free_mem"]- Commented out all
Serial.print's in all files MqttStatus.hadded #include "../../src/mqtt.h"MqttStatus.cppadded root["mqtt_fails"]SecuritySettingsService.cppadded version to the JWT payloadSecuritySettingsService.h#include "../../src/version.h"WiFiSettingsService.cppadded WiFi.setOutputPower(20.0f), moved setHostnameOTASettingsService.hadded #include "../../src/system.h"OTASettingsService.cppadded call to emsesp::System::upload_status(true)features.ini: -D FT_NTP=0platformio.iniusing our own versionfactory_settings.inimodified withems-esp-neoas password andems-espeverywhere else
To develop and test the Web UI
- uncomment the
-D ENABLE_CORSinplatformio.ini
cd interface
npm start
To test the core, standalone with an ESP
make run