Feature request: Command output diff showing only non-default settings
oakwhiz opened this issue · 2 comments
Is your feature request related to a problem? Please describe.
- It is difficult to determine what was changed on a Tasmota device.
decode-config -T command
is helpful but it shows every single command supported by the device, which makes it difficult to find portions that are relevant.
Describe the solution you'd like
- An option which retrieves the current configuration in command format using a minimal set of commands and arguments that would be required to restore the device to the current configuration from the default configuration.
- May require a method to account for differences in default settings or command syntax between Tasmota release versions.
Describe alternatives you've considered
- dumping a default config and using a
diff
tool to locate differences- this seems like it would work as long as the Tasmota command syntax does not exceed a certain complexity
Additional context
- Enterprise network devices often have a console command which prints all non-default configuration in a correct and minimized format. Any grouped or nested clauses are cleaned up, and the minimum set of optional arguments is used rather than every optional argument. (Hopefully.)
- This can be used to help visually locate configuration items that were changed. I would argue that this is an essential quality-of-life feature in those environments.
- It's not uncommon for certain items to be excluded if they are delegated to another component of the system, or if they have a security implication. Additionally some commands pertaining to persistent state or filesystem access might not be included. Perhaps any security credentials e.g. WiFi or MQTT passwords should be blinded by default, requiring positive action from the user to request those details be included.
regardless of the fact that the command output is insufficient for a complete configuration, what is a default config?
Since decode-config has no way of finding out what the default configuration of a Tasmota device is (maybe you mean what a Reset 1
does, I don't know), a difference cannot be determined automatically by accessing the Tasmota configuration data. Tasmota only allows querying and writing of the current binary encrypted configuration data, not more.
Apart from that, it is not recommended to use the output of -T cmnd
|-T command
as a complete configuration setup, as it is incomplete. The output of the Tasmota commands is intended to quickly convert conscious subsets of settings into Tasmota commands. It must be clear to the user that this is not complete and that the configuration of a Tasmota device using this way is incomplete.
I therefore recommend using the JSON format od decode-config as the basis for an initial setup.
You have to decide for yourselve and for your device(s) what a default configuration is, as this can be very different due to the use of USE_CONFIG_OVERRIDE, among other things.
I recommend then to create a default.json
, then with the help of external tools like git diff
the differences can be displayed:
git diff --no-index default.json current.json
I do not intend to implement such function processes in decode-config, which are helpful in themselves. That must be reserved for external tools and processes. decode-config should only remain the interface for this.
decode-config only serves to convert the unreadable Tasmota binary format into readable and vice versa.