mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-25 11:46:31 +00:00
Add checks
Add checks
This commit is contained in:
parent
9cab37e0f3
commit
dbf84d7813
@ -146,41 +146,45 @@ else:
|
|||||||
def StartDecode():
|
def StartDecode():
|
||||||
# print("Decoding\n{}".format(obj))
|
# print("Decoding\n{}".format(obj))
|
||||||
|
|
||||||
if ("Time" in obj["StatusSNS"]):
|
if ("StatusSNS" in obj):
|
||||||
time = str(" from status report taken at {}".format(obj["StatusSNS"]["Time"]))
|
if ("Time" in obj["StatusSNS"]):
|
||||||
if ("FriendlyName" in obj["Status"]):
|
time = str(" from status report taken at {}".format(obj["StatusSNS"]["Time"]))
|
||||||
print("\nDecoding information for device {}{}".format(obj["Status"]["FriendlyName"][0], time))
|
|
||||||
|
|
||||||
if ("SetOption" in obj["StatusLOG"]):
|
if ("Status" in obj):
|
||||||
options = []
|
if ("FriendlyName" in obj["Status"]):
|
||||||
option = obj["StatusLOG"]["SetOption"][0]
|
print("\nDecoding information for device {}{}".format(obj["Status"]["FriendlyName"][0], time))
|
||||||
i_option = int(option,16)
|
|
||||||
for i in range(len(a_setoption)):
|
|
||||||
if (a_setoption[i]):
|
|
||||||
state = (i_option >> i) & 1
|
|
||||||
options.append(str("{0:2d} ({1}) {2}".format(i, a_on_off[state], a_setoption[i])))
|
|
||||||
|
|
||||||
print("\nOptions")
|
if ("StatusLOG" in obj):
|
||||||
for i in range(len(options)):
|
if ("SetOption" in obj["StatusLOG"]):
|
||||||
print(" {}".format(options[i]))
|
options = []
|
||||||
|
option = obj["StatusLOG"]["SetOption"][0]
|
||||||
|
i_option = int(option,16)
|
||||||
|
for i in range(len(a_setoption)):
|
||||||
|
if (a_setoption[i]):
|
||||||
|
state = (i_option >> i) & 1
|
||||||
|
options.append(str("{0:2d} ({1}) {2}".format(i, a_on_off[state], a_setoption[i])))
|
||||||
|
|
||||||
|
print("\nOptions")
|
||||||
|
for i in range(len(options)):
|
||||||
|
print(" {}".format(options[i]))
|
||||||
|
|
||||||
if ("Features" in obj["StatusMEM"]):
|
if ("StatusMEM" in obj):
|
||||||
features = []
|
if ("Features" in obj["StatusMEM"]):
|
||||||
for f in range(5):
|
features = []
|
||||||
feature = obj["StatusMEM"]["Features"][f]
|
for f in range(5):
|
||||||
i_feature = int(feature,16)
|
feature = obj["StatusMEM"]["Features"][f]
|
||||||
if (f == 0):
|
i_feature = int(feature,16)
|
||||||
features.append(str("Language LCID = {}".format(i_feature & 0xFFFF)))
|
if (f == 0):
|
||||||
else:
|
features.append(str("Language LCID = {}".format(i_feature & 0xFFFF)))
|
||||||
for i in range(len(a_features[f -1])):
|
else:
|
||||||
if ((i_feature >> i) & 1):
|
for i in range(len(a_features[f -1])):
|
||||||
features.append(a_features[f -1][i])
|
if ((i_feature >> i) & 1):
|
||||||
|
features.append(a_features[f -1][i])
|
||||||
|
|
||||||
features.sort()
|
features.sort()
|
||||||
print("\nFeatures")
|
print("\nFeatures")
|
||||||
for i in range(len(features)):
|
for i in range(len(features)):
|
||||||
print(" {}".format(features[i]))
|
print(" {}".format(features[i]))
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user