Expand decode-status to support all feature bits

Output of decode-status.py lacks information about the latest two new sets of feature bits, due to the constant for array size not being updated when the array was expanded. Code changed to avoid this magical number, but instead check size of array with texts, and array with features from the JSON format in Status 4, using the lowest number to provide as many bits as both Tasmota version and Python code supports. A warning is printed if the number of feature bits from Tasmota is higher than supported in the current iteration of Python code.

Based on history, I'm assuming that updates are first done in arendst/Tasmota development, later replicated to tasmota/Tasmota-decode-status. If wrong, I can move the change there.
This commit is contained in:
sfromis 2021-05-12 18:44:13 +02:00 committed by GitHub
parent 2209046c6f
commit 972e39b607
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -337,7 +337,11 @@ def StartDecode():
if "StatusMEM" in obj: if "StatusMEM" in obj:
if "Features" in obj["StatusMEM"]: if "Features" in obj["StatusMEM"]:
features = [] features = []
for f in range(7): maxfeatures = len(obj["StatusMEM"]["Features"])
if maxfeatures > len(a_features):
print("decode-status.py too old, does not support all feature bits")
maxfeatures = min(maxfeatures, len(a_features))
for f in range(maxfeatures + 1):
feature = obj["StatusMEM"]["Features"][f] feature = obj["StatusMEM"]["Features"][f]
i_feature = int(feature,16) i_feature = int(feature,16)
if f == 0: if f == 0: