Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

settings section for defaulted custom settings not created by ui_bundle #680

Open
mosseb opened this issue Jun 3, 2020 · 2 comments
Open

Comments

@mosseb
Copy link

mosseb commented Jun 3, 2020

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/set topic
  • ui bundle add the section automatically when detecting some custom settings
  • Or maybe the simplest solution would be to always add an empty settings section 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 !

@mosseb mosseb changed the title settings section not created by ui_bundle settings section for defaulted custom settings not created by ui_bundle Jun 3, 2020
@mkfrey
Copy link
Contributor

mkfrey commented Jun 4, 2020

A fix for this patching issue is currently included in the develop branch, so try to use this if feasible.

@elbowz
Copy link
Contributor

elbowz commented Sep 2, 2021

Confirm, It works on develop branch 👍

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants