:symbols: Arduino Library for ESP32/ESP8266 - composition oriented internet of things framework that provides simple and extendable architecture, handles device setup (WiFi setup, MQTT and application specific configuration), network connectivity, MQTT telemetry protocol and more...
InjectManagerParameters method can be less dependent directly on WiFiManager.
First of all parameters can be changed to be stored as shared pointers.
Second - WiFiManagerParameter can be constructed via factorization or internally managed and created by method like addParameter.
setupMqttConnector is one of examples, ksIotFramework can load file on each reconnection to get credentials (it wouldn't cost a lot as reconnect doesn't happen every tick)
keep in mind that some paramters are not saved (for example PubSubClient's domain is only a char*)
Introduce function to covnert bool to HIGH or LOW. There are few places in the code that require translation from bool to HIGH/LOW states. This can be extracted into macro or inline function in ksConstants.
There is a problem, components can fail it's init procedure, but when app does not handle that, this component is not removed and loop method is called.
Create small class or struct that will handle millis() based timers, with method like setInterval and methods like justExpired() and replace old code with new mechanism
I've found that ksMqttDebugResponder returned uptime of component, not the device as mentioned in code.
Currently I've corrected variable names to avoid confusion, but it will be cool to have real device uptime somewhere.
This isn't trivial because calling millis() and converting to seconds or h:m:s is not resistant to roll-over.
What needs to be done:
Change variable name of deviceUptime -> componentUptime in ksMqttResponder.
Introduce real device uptime in ksMqttResponder (maybe use os_timer_arm?)
There is a bug, when user removes callback dynamically as it causes problems with ordering.
Index should be changed to something like ID, to uniquely identify callback.
Method like onDestroy() should be implemented to be able to mimic init behavior.
This will be useful to properly cleanup static objects, like ArduinoOTA, CAN etc.
Add method onDestroy() (this should be called from destructor method, but maybe it's good to avoid overriding destructor)
Update dependent projects
Now, init() method can be used to init() ArduinoOTA, but there is no safe place to call end() on it.
On my own setup, when sometimes there's an IP switch at midnight it looks like ESP8266 devices are unable to reconnect then.
It might have been WiFi connector issue (uint32_t operator LocalIP related) or it might have something to do with wifi timer.
If there's a lock on connect function, then WiFi tick might be unable to update network status.
WebPortal WS connection is unable to reconnect after uploading new firmware.
However, pressing F5 resolves the issue (browser is able to make re-load).
The issue should be investigated.