tasmota / decode-config

Backup/restore and decode configuration tool for Tasmota
GNU Lesser General Public License v3.0
215 stars 32 forks source link

When converting a dmp file to json, file name does not follow dmp file #11

Closed xbmcnut closed 4 years ago

xbmcnut commented 4 years ago

Describe the bug A clear and concise description of what the bug is. When using decode-config.py -f Config_washer_7021_8.1.0.dmp --backup-file Config-@f --backup-type json, the created file is name Config-Washing_Machine.json instead of Config_Washing_Machine.json (replaces underscore with hyphen).

To Reproduce Steps to reproduce the behavior: 1. Program parameter: 2. Result:

Expected behavior A clear and concise description of what you expected to happen. json file to match source filename.

Version Information (please complete the following information):

decode-config.py v8.1.0.10 [00085] by Norbert Richter nr@prsolution.eu

Script: decode-config.py Python: 3.7.7 Platform: Windows-10-10.0.18362-SP0 - AMD64 OS: Windows 10 10.0.18362 Time: 2020-03-19 22:18:33

- 'system' information of your Tasmota data (append `-g System` to your decode-config parameter, e. g. `decode-config -f myconfig.dmp -g System`):  

{"bootcount": 174, "cfg_crc": "0x1d7d", "cfg_crc32": "0xe700f372", "cfg_holder": 4617, "cfg_size": 4096, "cfg_timestamp": 1584500617, "displays": "0xffffffff", "energy_kWhtotal_time": 1543840427, "flag2": {"axis_resolution": 0}, "flag4": "0x00000000", "header": {"data": {"crc": "0x433d", "crc32": "0xe700f372", "size": 4096, "version": "0x8010000"}, "format": {"jsoncompact": false, "jsonhidepw": false, "jsonindent": null, "jsonsort": true}, "os": ["AMD64", "Windows", "10", "10.0.18362", "Windows-10-10.0.18362-SP0"], "python": "3.7.7", "script": {"name": "decode-config.py", "version": "8.1.0.10 [00085]"}, "template": {"crc": "0x1d7d", "crc32": "0xe700f372", "size": 4096, "version": "0x8010000"}, "timestamp": "2020-03-18 03:03:37"}, "last_module": 0, "monitors": "0xffffffff", "rgbwwTable": [255, 255, 255, 255, 255], "save_flag": 1312, "sps30_inuse_hours": 0, "timezone_minutes": 0, "version": "0x8010000"}



**Additional context**
_Add any other context about the problem here._
xbmcnut commented 4 years ago

Furthermore, if I try to restore the constructed json file by renaming it, I get the following error.

c:\Python\Python37>decode-config.py -d 10.0.1.176 --restore-file Config-Washing_Machine.json
WARNING 9: file '.\Config-Washing_Machine.json' - {'adc_param_type': 51} (valid range exceeding)
curzon01 commented 4 years ago

When using decode-config.py -f Config_washer_7021_8.1.0.dmp --backup-file Config-@f --backup-type json, the created file is name Config-Washing_Machine.json instead of Config_Washing_Machine.json (replaces underscore with hyphen).

not a bug, as designed if you want to have Config_Washing_Machine.json the correct parameter is --backup-file Config_@f (hyphen are not replaced)

curzon01 commented 4 years ago

Furthermore, if I try to restore the constructed json file by renaming it, I get the following error.

c:\Python\Python37>decode-config.py -d 10.0.1.176 --restore-file Config-Washing_Machine.json
WARNING 9: file '.\Config-Washing_Machine.json' - {'adc_param_type': 51} (valid range exceeding)

AdcParam is limited to 2-7. Correct your JSON or ignore the warning during restore by using --ignore-warnings

Reason might be garbadge in your Tasmota device config after an upgrade Suggestion: Backup config, use Tasmota Reset (e.g. param 5) and then restore config. Then it's clean.

xbmcnut commented 4 years ago

Thanks for the prompt reply and feedback. Much appreciated. I'm slowly getting my head around it.

curzon01 commented 4 years ago

your are welcome - add. note regarding suggestion:

Suggestion: Backup config using JSON format...

(it does not work when you use one of the binary format)

xbmcnut commented 4 years ago

So if I'm upgrading from older versions to 8.1, always use your tool to create a JSON file first rather than downloading a .dmp file from the GUI?

xbmcnut commented 4 years ago

Sorry to be a pain, but before I used your suggested migration method (thank you for that), I saved a dmp file (6.6.0) and have now converted that to a JSON file using your tool. If I upload the dmp file directly to the freshly reset device now running 8.1.0, everything is restored. If however I use this tool to upload the JSON version, I always get WARNING 9: file '.\Config_Washing_Machine.json' - {'adc_param_type': 51} (valid range exceeding)

Am I missing something? Sorry, but want to make a help video for my tubers but struggling a bit.

xbmcnut commented 4 years ago

Are, here we go. A bit more context. Used --ignore-warnings and got: WARNING 9: Restore file '.\Config_Washing_Machine.json' contains obsolete name 'novasds_period', skipped

curzon01 commented 4 years ago

Are, here we go. A bit more context. Used --ignore-warnings and got: WARNING 9: Restore file '.\Config_Washing_Machine.json' contains obsolete name 'novasds_period', skipped

novasds_period does not exist anymore in 8.1, delete this line from json. I will change decode-config so obsolete names will not stop restore anymore.

anyway: the safest way ugrading from 6.x to 8.x is using the Tasmota migration path (decode-config ist just for fail this procedure having a json backup). I used this on 25+ device with OTA (6.x->7.2->8.1), only one failed

curzon01 commented 4 years ago

sorry, ignore obsolete names is already in - it does what it says when using --ignore-warnings - skipped

in general: a WARNING will stop restore unless you use the command line parameter --ignore-warnings. In that case, warnings are still displayed but restore will be done.

use the -v parameter to get more verbose info, you will see what the program does and what not using -v

xbmcnut commented 4 years ago

Thanks! All very helpful.