homie-esp8266 icon indicating copy to clipboard operation
homie-esp8266 copied to clipboard

Feature request: custom user settings and limits

Open coal2001 opened this issue 4 years ago • 1 comments

  1. I have relay device with 3 relays.

  2. 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.

  1. 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.

coal2001 avatar Apr 01 '20 11:04 coal2001

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.

mkfrey avatar Apr 09 '20 14:04 mkfrey