tasmota / decode-config

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

Module missing from output #92

Closed ejohb closed 1 month ago

ejohb commented 1 month ago

Describe the bug

The module value is not included in the JSON or command output.

To Reproduce

  1. Output to config1.json
  2. Change the module in the Tasmota console, e.g. module 0 (previously it was 1)
  3. Output to config2.json
  4. Diff the two files.

Expected behavior

I would expect the see the module change reflected somewhere, but it isn't. Besides CRC and Boot Count values, the only change is this:

"last_module": 255,

In other words, it seems to include the last module, but not the current one.

Nor is there a Module command in the command output: decode-config.py --source moon.lan --output-format cmnd > config2.cmd

There is only the command: Module2 1

Version Information

decode-config.py v14.1.0.0 [33d9eb7] by Norbert Richter nr@prsolution.eu

Script:   decode-config.py
Version:  14.1.0.0 [33d9eb7]
Python:   3.10.12
Platform: Linux-5.15.0-117-generic-x86_64-with-glibc2.35 - x86_64
OS:       Linux 5.15.0-117-generic #127-Ubuntu SMP Fri Jul 5 20:13:28 UTC 2024
Time:     2024-08-05 15:35:15

System' information of your Tasmota data

{
  "bootcount": 20, 
  "bootcount_reset_time": 1720277280, 
  "cfg_crc": "0x483b", 
  "cfg_crc32": "0x01a6f150", 
  "cfg_holder": 4617, 
  "cfg_size": 4096, 
  "cfg_timestamp": 1722869080, 
  "header": {
    "data": {
      "crc": "0x7661", 
      "crc32": "0x1a6f150", 
      "hardware": "ESP82", 
      "size": 4096, 
      "version": {
        "id": "0xe010000", 
        "name": "14.1.0"
      }
    }, 
    "env": {
      "platform": "Linux-5.15.0-117-generic-x86_64-with-glibc2.35", 
      "python": "3.10.12", 
      "script": "decode-config.py v14.1.0.0 [33d9eb7]", 
      "system": "Linux x86_64 5.15.0-117-generic #127-Ubuntu SMP Fri Jul 5 20:13:28 UTC 2024"
    }, 
    "template": {
      "crc": "0x483b", 
      "crc32": "0x1a6f150", 
      "size": 4096, 
      "version": {
        "id": "0xe010000", 
        "name": "14.1.0"
      }
    }, 
    "timestamp": "2024-08-05 14:44:40"
  }, 
  "version": "0xe010000"
}
ejohb commented 1 month ago

@curzon01

Thanks a lot for addressing this. Just to check, the module value is now offset by -1. Is this expected?

09:14:55.924 MQT: tasmota/device/bedroom-fan/stat/RESULT = {"Module":{"1":"Sonoff Basic"}}

Results in: "module": 0,

and Module 0 outputs 255, etc.

curzon01 commented 1 month ago

yes, that's corect.

The json output contains the human readable content of the internal Tasmota settings struct (see decode-config .json format) and Tasmota handles these settings this way. The internally (Tasmota) processed data is not always the same as you are familiar with from Tasmota cmnd. That's why you got -1 for 0. But there are only a few settings data that differ in this way. The parameter for this data is corrected by decode-config when outputting in Tasmota cmnd format (param -T or ) by adjusting the described command parameter.

ejohb commented 1 month ago

@curzon01 That's great. Many thanks for clarifying.