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 Yves De Muyter
parent 348bbd280f
commit 63f1334296
1 changed files with 5 additions and 1 deletions

View File

@ -337,7 +337,11 @@ def StartDecode():
if "StatusMEM" in obj:
if "Features" in obj["StatusMEM"]:
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]
i_feature = int(feature,16)
if f == 0: