settings section for defaulted custom settings not created by ui_bundle
Hi. I have 2 custom settings like that :
upCourseTimeSetting.setDefaultValue(SHUTTER_COURSETIME_MAX).setValidator(validator);
downCourseTimeSetting.setDefaultValue(SHUTTER_COURSETIME_MAX).setValidator(validator);
Initially I manually add an empty settings section in the JSON config that I upload via SPIFFS.
Then I use MQTT message to populate the values.
So far so good.
In the case the configuration goes in an unwanted state (wrong manipulation), I implemented a way to reset the module to default settings, by issuing a Homie.reset();
It restarts, goes into configuration mode and spawns the AP.
I enter all the needed informations, it reboots...
And unfortunately, the settings section is lost and doesn't exist anymore in $implementation/config
And I cannot add it again because of the error :
✖ Config does not contain a settings object
I would expect the both things to be possible :
- I can add a custom settings to the JSON settings by passing it on the
$implementation/config/settopic - ui bundle add the section automatically when detecting some custom settings
- Or maybe the simplest solution would be to always add an empty
settingssection at boot if it does not exist, or remove the "config does not contain a settings object" error and actually add it instead.
Not that if I remove setDefaultValue, the UI bundle forces to enter a value and correctly creates the settings section.
Thanks !
A fix for this patching issue is currently included in the develop branch, so try to use this if feasible.
Confirm, It works on develop branch :+1:
Thanks!