-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Define Template in "user_config_override.h" #8464
Comments
I know it's not exactly what you requested but may be decode-config would help? Create a JSON text file e.g.
then load this config part using |
Not a bad solution however it would be less effort to edit the template and check off "activate" within the "Configure Other" menu when setting the display name. The main goal is for the device to function in its normal operating state should it get accidentally reset or spontaneously reset. I had noticed that it had been requested a few times but I think those were all before templates existed. If its a lot of work then it certainly isn't a necessity it would just really give people that are compiling firmware more options for firmware customization. Especially considering the number of devices on the blackadder site. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Will have a look... |
Indeed currently it will be reset to a Sonoff Basic on multiple power drops and/or restarts. As implementing a fixed template in user_config_override.h will take some additional code I think it's more realistic to make the auto fallback to Sonoff Basic optional. I think I'll implement an option to switch between either Sonoff Basic (Module 1) OR the active template (Module 0). This way no fixed template needs to be compiled while there is a solution for the case where the Sonoff Basic module won't work as fallback module (like an ESP32 ethernet device ;-) |
That would be good, For devices that don't have the same pinout of the Sonoff Basic it would allow the user to still be able to interact with the button to get the multiple click actions |
For the choice between module (1 - basic) or the active template, would module 18 - Generic be the safest fallback? |
Add command ``Module2`` to configure fallback module on fast reboot (#8464)
Make FALLBACK_MODULE configurable (#8464)
Good question. For now the default is SONOFF_BASIC for ESP8266 and WEMOS for ESP32. It can be changed in my_user_config.h with define FALLBACK_MODULE |
I have a custom hardware module for which I configure a custom template derived from Generic 18. |
@ramanraja you solves problem for activate user template in reset? |
#define MODULE USER_MODULE |
Thanks, works fine!! |
I like that. So I can define the template at compile time and have it be activated automatically after I uploaded the firmware? Just to be sure, would adding this to
|
That will only add a template, but that is not activated. If you want to also activate it, you must do the following in user_config_override.h: #ifdef MODULE
#undef MODULE
#endif
#define MODULE USER_MODULE // [Module] Select default model (the list is kModuleNiceList() in file tasmota_template.h) USER_MODULE is the TEMPLATE
#ifdef FALLBACK_MODULE
#undef FALLBACK_MODULE
#endif
#define FALLBACK_MODULE USER_MODULE // to Select the default model as FALLBACK when the user does a RESET 1
#ifdef USER_TEMPLATE
#undef USER_TEMPLATE
#endif
#define USER_TEMPLATE "{\"NAME\":\"ESP01-Dimmer\",\"GPIO\":[1,1,416,1,1,1,1,1,1,1,1,1,1,1],\"FLAG\":0,\"BASE\":18}" // [Template] Set JSON template
Remember that if the device is blank, the template will be activated. But if the device is not blank (It has an older version of Tasmota) you must do a ´reset 1´ in the console to reset all settings to default and make the device to start using the template defined as default in your firmware. |
Thank you for the help and the quick reply! |
Have you looked for this feature in other issues and in the docs?
Yes
Is your feature request related to a problem? Please describe.
Currently there is no way to specify a customized PIN/module configuration from the config override file.
This situation has been requested multiple times in the past though not specifically using templating as the solution:
#5068
#3747
#3258
Describe the solution you'd like
If the ability to define the default template was added to this file it would be a single option to configure:
Then individuals compiling the firmware could set the module to 255 to enable that template as the default when initially flashing or when resetting the configuration.
Describe alternatives you've considered
I have reviewed the suggestions in similar requests and the proposed solutions such as "creating something separate to automatically set the settings via serial or otherwise; Setting up a device then backup, restore to each device; Flash one device, set it up and read the flash back to then write to other devices as the firmware. None of these are as elegant as specifying a template in the user_config_override file and setting the template as the active module.
Additional context
The main reason for this is to create firmware where the device is fully configured for that use case to offset issues with an unexpected reset (either by someone holding the button for too long [kids...], or if the device was to spontaneously reset (as was indicated in one of those linked issues)
(Please, remember to close the issue when the problem has been addressed)
The text was updated successfully, but these errors were encountered: