Added webGUI, implemented communication API, save wifi credentials and general config to file
General info
- Added web GUI to folder: SW/Web-Configurator
- Added WifiManager for managing configuration of wifi state
- Added Base64 library by
Arturo Guadalupi
directly to the project, because importing library with library manager didn't work, see Base64Class.h - changed ConfigManager.cpp in order to be able to load config from file - WIP
API
These are the implemented API commands:
-
setWifi <SSID> <password>
: sets the credentials to be used to connect with wifi -
tts <text>
: plays the given text using text-to-speech -
toggleWiFi <on | any>
: turn on wifi if agrument ison
, otherwise turn off wifi -
rm <filename>
: removes<filename>.mp3
from SD card (in order to remove cached version of TTS) -
wav <filename>
: plays<filename>.wav
from SD card -
mp3 <filename>
: plays<filename>.mp3
from SD card -
vol <0..100)>
sets sound volumne to given value -
restart
orreboot
: restarts the system -
refreshtokens
: refreshes HomeConnect access tokens -
checktokens
: check HomeConnect access tokens if they are valid -
time
: prints current system time as timestamp -
logheap
toggles printing current heap memory usage -
wifiinfo
: returns currently used SSID -
setConfiguration <configJSON>
: takes a JSON string representing the system configuration, saves it and reboots for using this configuration -
callAPIEncoded <cmdName> <arg1> <arg2>
: possibility to call all other API commands with base64 encoded arguments. For instancecallAPIEncoded setWifi bXlXaWZp bXlQYXNzd29yZA==
will callsetWifi myWifi myPassword
internally.
Calling the API via callAPIEncoded
is used for communication with the WebGUI in order to make it possible to send values including spaces, e.g. a wifi password.
WifiManager
Some information about the new behaviour of WifiManager:
- credentials are read from file
WifiData.txt
from SD card - connecting to Wifi is tried 3 times or at maximum 60 seconds, afterwards device is used without Wifi (new credentials could be set via API)
Start WebGUI
Go to folder SW/Web-Configurator and run npm install
and npm run serve
, also see Readme.md
Important notes for further development
- the API call
setConfiguration <configJSON>
currently isn't working, because we ran into memory issues. Config files currently are about 15000 characters long and raising the limits for API arguments and adding big arrays toConfigManager.cpp
for holding such big arrays led to boot loops of the M5Stack. See this commit for fixing the reboot loop. - communication from
M5Stack -> WebGUI
is not finished. The WebGUI receives everything sent from M5Stack over Serial, but there is no mechanism to detect what is a result to a prior API call.
Edited by Benjamin Klaus