mirror of https://github.com/arendst/Tasmota.git
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:
parent
2209046c6f
commit
972e39b607
|
@ -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:
|
||||||
|
|
Loading…
Reference in New Issue