homie-esp8266
homie-esp8266 copied to clipboard
Feature request: custom user settings and limits
-
I have relay device with 3 relays.
-
For each relay I need many custom settings, which are saved in flash. This is real need, example of settings for each relay:
- node is enabled (button can be absent)
- node friendly name (for UI)
- button functional friendly name (for UI)
- topic to subscribe on other devices (i.e. set ventilation relay "on" when humidity is high on other device)
and also I need three settings for this device:
- place name (for UI)
- button double click interval
- button long action interval
So, I need 15 custom user settings (HomieSetting) for this relay device, which I can save in flash.
- Unfortunately, there is limit only to 10 user settings (Limits.hpp). And I can't override this, because of using "const" instead of "define".
const uint16_t MAX_JSON_CONFIG_FILE_SIZE = 2000;
const uint8_t MAX_CONFIG_SETTING_SIZE = 20;
So, I request change "const" to "define" so, that user could redefine limits in his build settings.
Also, there is need in function to write setting in flash from code (first time). Currently I make that by sending message to self through broker, and then write to flash - but that is very complex.
Please feel free to create a pull request changing the behaviour of the limits to use defines.
Regarding your second issue: You could patch the config the following way:
using namespace HomieInternals;
...
Interface::get().getConfig().patch("{}");
without making the device send the patch through MQTT to itself.