mirror of https://github.com/arendst/Tasmota.git
Merge pull request #4851 from curzon01/development
decode-config.py: adapt settings
This commit is contained in:
commit
efed4b244e
|
@ -1,10 +1,10 @@
|
|||
<h1 id="decode-config-py">decode-config.py</h1>
|
||||
<p><em>decode-config.py</em> is able to backup and restore Sonoff-Tasmota configuration.</p>
|
||||
<p>In contrast to the Tasmota build-in "Backup/Restore Configuration" function,</p>
|
||||
<p>In comparison with the Tasmota build-in "Backup/Restore Configuration" function <em>decode-config.py</em></p>
|
||||
<ul>
|
||||
<li><em>decode-config.py</em> uses human readable and editable <a href="http://www.json.org/">JSON</a>-format for backup/restore,</li>
|
||||
<li><em>decode-config.py</em> can restore previous backuped and changed <a href="http://www.json.org/">JSON</a>-format files,</li>
|
||||
<li><em>decode-config.py</em> is able to create Tasmota commands based on given configuration</li>
|
||||
<li>uses human readable and editable <a href="http://www.json.org/">JSON</a>-format for backup/restore,</li>
|
||||
<li>can restore previously backup and changed <a href="http://www.json.org/">JSON</a>-format files,</li>
|
||||
<li>is able to create Tasmota compatible command list with related config parameter</li>
|
||||
</ul>
|
||||
<p>Comparing backup files created by <em>decode-config.py</em> and *.dmp files created by Tasmota "Backup/Restore Configuration": </p>
|
||||
<table>
|
||||
|
@ -38,7 +38,7 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><em>decode-config.py</em> is able to handle Tasmota configurations for release version starting from 5.10.0 up to now.</p>
|
||||
<p><em>decode-config.py</em> is compatible with Tasmota version from v5.10.0 up to now.</p>
|
||||
<h1 id="content">Content</h1>
|
||||
<ul>
|
||||
<li><a href="decode-config.md#prerequisite">Prerequisite</a></li>
|
||||
|
@ -75,11 +75,11 @@
|
|||
</ul>
|
||||
<h2 id="prerequisite">Prerequisite</h2>
|
||||
<ul>
|
||||
<li><p><a href="https://en.wikipedia.org/wiki/Python_(programming_language">Python</a>)<br>This program is written in <a href="https://en.wikipedia.org/wiki/Python_(programming_language">Python</a>) so you need to install a python environment (for details see <a href="https://docs.python.org/2.7/using/index.html">Python Setup and Usage</a>)</p>
|
||||
<li><p><a href="https://en.wikipedia.org/wiki/Python_(programming_language">Python</a>)<br>This program is written in <a href="https://en.wikipedia.org/wiki/Python_(programming_language">Python</a>) so you need to install a working python environment (for details see <a href="https://docs.python.org/2.7/using/index.html">Python Setup and Usage</a>)</p>
|
||||
</li>
|
||||
<li><p><a href="https://github.com/arendst/Sonoff-Tasmota">Sonoff-Tasmota</a> <a href="https://github.com/arendst/Sonoff-Tasmota/releases">Firmware</a> with Web-Server enabled:</p>
|
||||
<ul>
|
||||
<li>To backup or restore configurations from/to a Sonoff-Tasmota device you need a firmare with enabled web-server in admin mode (command <a href="https://github.com/arendst/Sonoff-Tasmota/wiki/Commands#wifi">WebServer 2</a>).</li>
|
||||
<li>To backup or restore configurations from or to a Sonoff-Tasmota device you need a firmare with enabled web-server in admin mode (command <a href="https://github.com/arendst/Sonoff-Tasmota/wiki/Commands#wifi">WebServer 2</a>). This is the Tasmota default.</li>
|
||||
<li>If using your own compiled firmware be aware to enable the web-server (<code>#define USE_WEBSERVER</code> and <code>#define WEB_SERVER 2</code>).</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
@ -89,19 +89,20 @@
|
|||
<h3 id="-dmp-format">.dmp Format</h3>
|
||||
<p>Configuration data as used by Tasmota "Backup/Restore Configuration" web interface.<br>This format is binary and encrypted.</p>
|
||||
<h3 id="-json-format">.json Format</h3>
|
||||
<p>Configuration data in <a href="http://www.json.org/">JSON</a>-format.<br>This format is decrypted, human readable and editable and can also be used for the <code>--restore-file</code> command.<br>This file will becreated by <em>decode-config.py</em> using <code>--backup-file</code> with <code>--backup-type json</code> parameter (default).</p>
|
||||
<p>Configuration data in <a href="http://www.json.org/">JSON</a>-format.<br>This format is decrypted, human readable and editable and can also be used for the <code>--restore-file</code> parameter.<br>This file will be created by <em>decode-config.py</em> using the <code>--backup-file</code> with <code>--backup-type json</code> parameter, this is the default.</p>
|
||||
<h3 id="-bin-format">.bin Format</h3>
|
||||
<p>Configuration data in binary format.<br>This format is binary decryptet, editable (e.g. using a hex editor) and can also be used for <code>--restore-file</code> command.<br>It will be created by <em>decode-config.py</em> using <code>--backup-file</code> with <code>--backup-type bin</code>.<br>Note:<br>This file is 4 byte longer than an original .dmp file due to an prefix header at the beginning. The file data starting at address position 4 are containing the same as the <strong>struct SYSCFG</strong> from Tasmota <a href="https://github.com/arendst/Sonoff-Tasmota/blob/master/sonoff/settings.h">settings.h</a> in decrypted format.</p>
|
||||
<p>Configuration data in binary format.<br>This format is binary decryptet, editable (e.g. using a hex editor) and can also be used for <code>--restore-file</code> command.<br>It will be created by <em>decode-config.py</em> using <code>--backup-file</code> with <code>--backup-type bin</code>.<br>Note:<br>The .bin file contains the same information as the original .dmp file from Tasmota "Backup/Restore Configuration" but it is decrpted and 4 byte longer than an original (it is a prefix header at the beginning). .bin file data starting at address 4 contains the same as the <strong>struct SYSCFG</strong> from Tasmota <a href="https://github.com/arendst/Sonoff-Tasmota/blob/master/sonoff/settings.h">settings.h</a> in decrypted format.</p>
|
||||
<h4 id="file-extensions">File extensions</h4>
|
||||
<p><em>decode-config.py</em> uses auto extension as default for backup filenames; you don't need to append extensions to your backup file, it will be selected based on <code>--backup-type</code> argument.<br>If you want using your own extension use the <code>--no-extension</code> argument.</p>
|
||||
<p>You don't need to append exensions for your file name as <em>decode-config.py</em> uses auto extension as default. The extension will be choose based on file contents and <code>--backup-type</code> parameter.
|
||||
If you do not want using auto extensions use the <code>--no-extension</code> parameter.</p>
|
||||
<h2 id="usage">Usage</h2>
|
||||
<p>After download don't forget to set exec flag under linux with <code>chmod +x decode-config.py</code> or call the program using <code>python decode-config.py...</code>.</p>
|
||||
<p>After download don't forget to set the executable flag under linux with <code>chmod +x decode-config.py</code> or call the program using <code>python decode-config.py...</code>.</p>
|
||||
<h3 id="basics">Basics</h3>
|
||||
<p>At least pass a source where you want to read the configuration data from using <code>-f <filename></code> or <code>-d <host></code>:</p>
|
||||
<p>The source can be either </p>
|
||||
<ul>
|
||||
<li>a Tasmota device hostname or IP by passing it using the <code>-d <host></code> arg</li>
|
||||
<li>or a previously stored Tasmota <code>*.dmp</code> configuration file by passing the filename using <code>-f <filename></code> arg</li>
|
||||
<li>a Tasmota device hostname or IP using the <code>-d <host></code> parameter</li>
|
||||
<li>a Tasmota <code>*.dmp</code> configuration file using <code>-f <filename></code> parameter</li>
|
||||
</ul>
|
||||
<p>Example: </p>
|
||||
<pre><code>decode-config<span class="hljs-selector-class">.py</span> -d sonoff-<span class="hljs-number">4281</span>
|
||||
|
@ -119,22 +120,22 @@
|
|||
]
|
||||
}
|
||||
</code></pre><h3 id="save-backup-file">Save backup file</h3>
|
||||
<p>To save the output as backup file <code>--backup-file <filename></code>, you can use placeholder for Version, Friendlyname and Hostname: </p>
|
||||
<p>To save the output as backup file use <code>--backup-file <filename></code>, you can use placeholder for Version, Friendlyname and Hostname: </p>
|
||||
<pre><code><span class="hljs-selector-tag">decode-config</span><span class="hljs-selector-class">.py</span> <span class="hljs-selector-tag">-d</span> <span class="hljs-selector-tag">sonoff-4281</span> <span class="hljs-selector-tag">--backup-file</span> <span class="hljs-selector-tag">Config_</span>@<span class="hljs-keyword">f_</span>@<span class="hljs-keyword">v</span>
|
||||
</code></pre><p>If you have setup a WebPassword within Tasmota, use</p>
|
||||
<pre><code>decode-config<span class="hljs-selector-class">.py</span> -d sonoff-<span class="hljs-number">4281</span> -<span class="hljs-selector-tag">p</span> <yourpassword> --backup-file Config_@f_@v
|
||||
</code></pre><p>will create a file like <code>Config_Sonoff_x.x.x.json</code>. Because it is in JSON format, you can read and edit the file with any raw text editor.</p>
|
||||
</code></pre><p>will create a file like <code>Config_Sonoff_6.4.0.json</code> (the part <code>Sonoff</code> and <code>6.4.0</code> will choosen related to your device configuration). Because the default backup file format is JSON, you can read and change it with any raw text editor.</p>
|
||||
<h3 id="restore-backup-file">Restore backup file</h3>
|
||||
<p>Reading back a saved (and possible changed) backup file use the <code>--restore-file <filename></code> arg. This will read the (changed) configuration data from this file and send it back to the source device or filename.</p>
|
||||
<p>Reading back a saved (and possible changed) backup file use the <code>--restore-file <filename></code> parameter. This will read the (changed) configuration data from this file and send it back to the source device or filename.</p>
|
||||
<p>To restore the previously save backup file <code>Config_Sonoff_6.2.1.json</code> to device <code>sonoff-4281</code> use: </p>
|
||||
<pre><code><span class="hljs-selector-tag">decode-config</span><span class="hljs-selector-class">.py</span> <span class="hljs-selector-tag">-d</span> <span class="hljs-selector-tag">sonoff-4281</span> <span class="hljs-selector-tag">--restore-file</span> <span class="hljs-selector-tag">Config_Sonoff_6</span><span class="hljs-selector-class">.2</span><span class="hljs-selector-class">.1</span><span class="hljs-selector-class">.json</span>
|
||||
</code></pre><p>with password set by WebPassword:</p>
|
||||
<pre><code><span class="hljs-selector-tag">decode-config</span><span class="hljs-selector-class">.py</span> <span class="hljs-selector-tag">-d</span> <span class="hljs-selector-tag">sonoff-4281</span> <span class="hljs-selector-tag">-p</span> <<span class="hljs-selector-tag">yourpassword</span>> <span class="hljs-selector-tag">--restore-file</span> <span class="hljs-selector-tag">Config_Sonoff_6</span><span class="hljs-selector-class">.2</span><span class="hljs-selector-class">.1</span><span class="hljs-selector-class">.json</span>
|
||||
</code></pre><h3 id="output-to-screen">Output to screen</h3>
|
||||
<p>Output to screen is default enabled when calling the program with a source arg but without a backup or restore arg.</p>
|
||||
<p><code>--output</code> arg will force screen output even if you use backup or restore arg.</p>
|
||||
<p>To force screen output use the <code>--output</code> parameter.</p>
|
||||
<p>Output to screen is default enabled when calling the program with a source parameter (-f or -d) but without any backup or restore parameter.</p>
|
||||
<h4 id="json-output">JSON output</h4>
|
||||
<p>The default output format is JSON. You can force JSON output with <code>--output-format json</code> arg.</p>
|
||||
<p>The default output format is <a href="decode-config.md#-json-format">JSON</a>. You can force JSON output using the <code>--output-format json</code> parameter.</p>
|
||||
<p>Example:</p>
|
||||
<pre><code>decode-config.py -d sonoff<span class="hljs-number">-4281</span> -c my.conf -x <span class="hljs-symbol">Wifi</span> --output-format json
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# decode-config.py
|
||||
_decode-config.py_ is able to backup and restore Sonoff-Tasmota configuration.
|
||||
|
||||
In contrast to the Tasmota build-in "Backup/Restore Configuration" function,
|
||||
* _decode-config.py_ uses human readable and editable [JSON](http://www.json.org/)-format for backup/restore,
|
||||
* _decode-config.py_ can restore previous backuped and changed [JSON](http://www.json.org/)-format files,
|
||||
* _decode-config.py_ is able to create Tasmota commands based on given configuration
|
||||
In comparison with the Tasmota build-in "Backup/Restore Configuration" function _decode-config.py_
|
||||
* uses human readable and editable [JSON](http://www.json.org/)-format for backup/restore,
|
||||
* can restore previously backup and changed [JSON](http://www.json.org/)-format files,
|
||||
* is able to create Tasmota compatible command list with related config parameter
|
||||
|
||||
Comparing backup files created by *decode-config.py* and *.dmp files created by Tasmota "Backup/Restore Configuration":
|
||||
|
||||
|
@ -15,7 +15,7 @@ Comparing backup files created by *decode-config.py* and *.dmp files created by
|
|||
| Simply editable | Yes | No |
|
||||
| Simply batch processing | Yes | No |
|
||||
|
||||
_decode-config.py_ is able to handle Tasmota configurations for release version starting from 5.10.0 up to now.
|
||||
_decode-config.py_ is compatible with Tasmota version from v5.10.0 up to now.
|
||||
|
||||
# Content
|
||||
* [Prerequisite](decode-config.md#prerequisite)
|
||||
|
@ -42,10 +42,10 @@ _decode-config.py_ is able to handle Tasmota configurations for release version
|
|||
|
||||
## Prerequisite
|
||||
* [Python](https://en.wikipedia.org/wiki/Python_(programming_language))
|
||||
This program is written in [Python](https://en.wikipedia.org/wiki/Python_(programming_language)) so you need to install a python environment (for details see [Python Setup and Usage](https://docs.python.org/2.7/using/index.html))
|
||||
This program is written in [Python](https://en.wikipedia.org/wiki/Python_(programming_language)) so you need to install a working python environment (for details see [Python Setup and Usage](https://docs.python.org/2.7/using/index.html))
|
||||
|
||||
* [Sonoff-Tasmota](https://github.com/arendst/Sonoff-Tasmota) [Firmware](https://github.com/arendst/Sonoff-Tasmota/releases) with Web-Server enabled:
|
||||
* To backup or restore configurations from/to a Sonoff-Tasmota device you need a firmare with enabled web-server in admin mode (command [WebServer 2](https://github.com/arendst/Sonoff-Tasmota/wiki/Commands#wifi)).
|
||||
* To backup or restore configurations from or to a Sonoff-Tasmota device you need a firmare with enabled web-server in admin mode (command [WebServer 2](https://github.com/arendst/Sonoff-Tasmota/wiki/Commands#wifi)). This is the Tasmota default.
|
||||
* If using your own compiled firmware be aware to enable the web-server (`#define USE_WEBSERVER` and `#define WEB_SERVER 2`).
|
||||
|
||||
## File Types
|
||||
|
@ -55,28 +55,28 @@ Configuration data as used by Tasmota "Backup/Restore Configuration" web interfa
|
|||
This format is binary and encrypted.
|
||||
### .json Format
|
||||
Configuration data in [JSON](http://www.json.org/)-format.
|
||||
This format is decrypted, human readable and editable and can also be used for the `--restore-file` command.
|
||||
This file will becreated by _decode-config.py_ using `--backup-file` with `--backup-type json` parameter (default).
|
||||
This format is decrypted, human readable and editable and can also be used for the `--restore-file` parameter.
|
||||
This file will be created by _decode-config.py_ using the `--backup-file` with `--backup-type json` parameter, this is the default.
|
||||
### .bin Format
|
||||
Configuration data in binary format.
|
||||
This format is binary decryptet, editable (e.g. using a hex editor) and can also be used for `--restore-file` command.
|
||||
It will be created by _decode-config.py_ using `--backup-file` with `--backup-type bin`.
|
||||
Note:
|
||||
This file is 4 byte longer than an original .dmp file due to an prefix header at the beginning. The file data starting at address position 4 are containing the same as the **struct SYSCFG** from Tasmota [settings.h](https://github.com/arendst/Sonoff-Tasmota/blob/master/sonoff/settings.h) in decrypted format.
|
||||
The .bin file contains the same information as the original .dmp file from Tasmota "Backup/Restore Configuration" but it is decrpted and 4 byte longer than an original (it is a prefix header at the beginning). .bin file data starting at address 4 contains the same as the **struct SYSCFG** from Tasmota [settings.h](https://github.com/arendst/Sonoff-Tasmota/blob/master/sonoff/settings.h) in decrypted format.
|
||||
|
||||
#### File extensions
|
||||
_decode-config.py_ uses auto extension as default for backup filenames; you don't need to append extensions to your backup file, it will be selected based on `--backup-type` argument.
|
||||
If you want using your own extension use the `--no-extension` argument.
|
||||
You don't need to append exensions for your file name as _decode-config.py_ uses auto extension as default. The extension will be choose based on file contents and `--backup-type` parameter.
|
||||
If you do not want using auto extensions use the `--no-extension` parameter.
|
||||
|
||||
## Usage
|
||||
After download don't forget to set exec flag under linux with `chmod +x decode-config.py` or call the program using `python decode-config.py...`.
|
||||
After download don't forget to set the executable flag under linux with `chmod +x decode-config.py` or call the program using `python decode-config.py...`.
|
||||
|
||||
### Basics
|
||||
At least pass a source where you want to read the configuration data from using `-f <filename>` or `-d <host>`:
|
||||
|
||||
The source can be either
|
||||
* a Tasmota device hostname or IP by passing it using the `-d <host>` arg
|
||||
* or a previously stored Tasmota `*.dmp` configuration file by passing the filename using `-f <filename>` arg
|
||||
* a Tasmota device hostname or IP using the `-d <host>` parameter
|
||||
* a Tasmota `*.dmp` configuration file using `-f <filename>` parameter
|
||||
|
||||
Example:
|
||||
|
||||
|
@ -99,7 +99,7 @@ will output a human readable configuration in [JSON](http://www.json.org/)-forma
|
|||
|
||||
|
||||
### Save backup file
|
||||
To save the output as backup file `--backup-file <filename>`, you can use placeholder for Version, Friendlyname and Hostname:
|
||||
To save the output as backup file use `--backup-file <filename>`, you can use placeholder for Version, Friendlyname and Hostname:
|
||||
|
||||
decode-config.py -d sonoff-4281 --backup-file Config_@f_@v
|
||||
|
||||
|
@ -107,10 +107,10 @@ If you have setup a WebPassword within Tasmota, use
|
|||
|
||||
decode-config.py -d sonoff-4281 -p <yourpassword> --backup-file Config_@f_@v
|
||||
|
||||
will create a file like `Config_Sonoff_x.x.x.json`. Because it is in JSON format, you can read and edit the file with any raw text editor.
|
||||
will create a file like `Config_Sonoff_6.4.0.json` (the part `Sonoff` and `6.4.0` will choosen related to your device configuration). Because the default backup file format is JSON, you can read and change it with any raw text editor.
|
||||
|
||||
### Restore backup file
|
||||
Reading back a saved (and possible changed) backup file use the `--restore-file <filename>` arg. This will read the (changed) configuration data from this file and send it back to the source device or filename.
|
||||
Reading back a saved (and possible changed) backup file use the `--restore-file <filename>` parameter. This will read the (changed) configuration data from this file and send it back to the source device or filename.
|
||||
|
||||
To restore the previously save backup file `Config_Sonoff_6.2.1.json` to device `sonoff-4281` use:
|
||||
|
||||
|
@ -121,12 +121,12 @@ with password set by WebPassword:
|
|||
decode-config.py -d sonoff-4281 -p <yourpassword> --restore-file Config_Sonoff_6.2.1.json
|
||||
|
||||
### Output to screen
|
||||
Output to screen is default enabled when calling the program with a source arg but without a backup or restore arg.
|
||||
To force screen output use the `--output` parameter.
|
||||
|
||||
`--output` arg will force screen output even if you use backup or restore arg.
|
||||
Output to screen is default enabled when calling the program with a source parameter (-f or -d) but without any backup or restore parameter.
|
||||
|
||||
#### JSON output
|
||||
The default output format is JSON. You can force JSON output with `--output-format json` arg.
|
||||
The default output format is [JSON](decode-config.md#-json-format). You can force JSON output using the `--output-format json` parameter.
|
||||
|
||||
Example:
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
VER = '2.1.0016'
|
||||
VER = '2.1.0017'
|
||||
|
||||
"""
|
||||
decode-config.py - Backup/Restore Sonoff-Tasmota configuration data
|
||||
|
@ -819,7 +819,13 @@ Setting_6_4_1_4['flag3'][0].update ({
|
|||
'mdns_enabled': ('<L', (0x3A0,1, 5), (None, None, ('SetOption', '"SetOption55 {}".format($)')) ),
|
||||
})
|
||||
# ======================================================================
|
||||
Setting_6_4_1_7 = copy.deepcopy(Setting_6_4_1_4)
|
||||
Setting_6_4_1_7['flag3'][0].update ({
|
||||
'no_pullup': ('<L', (0x3A0,1,12), (None, None, ('SetOption', '"SetOption62 {}".format($)')) ),
|
||||
})
|
||||
# ======================================================================
|
||||
Settings = [
|
||||
(0x6040107, 0xe00, Setting_6_4_1_7),
|
||||
(0x6040104, 0xe00, Setting_6_4_1_4),
|
||||
(0x6040002, 0xe00, Setting_6_4_0_2),
|
||||
(0x6030010, 0xe00, Setting_6_3_0_16),
|
||||
|
|
Loading…
Reference in New Issue