mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-25 11:46:31 +00:00
Update decode-status.py
Update decode-status.py
This commit is contained in:
parent
52f642b0c0
commit
cb192c5c2d
@ -1371,8 +1371,8 @@ void PublishStatus(uint8_t payload)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((0 == payload) || (3 == payload)) {
|
if ((0 == payload) || (3 == payload)) {
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_STATUS D_STATUS3_LOGGING "\":{\"" D_CMND_SERIALLOG "\":%d,\"" D_CMND_WEBLOG "\":%d,\"" D_CMND_SYSLOG "\":%d,\"" D_CMND_LOGHOST "\":\"%s\",\"" D_CMND_LOGPORT "\":%d,\"" D_CMND_SSID "\":[\"%s\",\"%s\"],\"" D_CMND_TELEPERIOD "\":%d,\"" D_CMND_SETOPTION "\":[\"%08X\",\"%08X\"]}}"),
|
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_STATUS D_STATUS3_LOGGING "\":{\"" D_CMND_SERIALLOG "\":%d,\"" D_CMND_WEBLOG "\":%d,\"" D_CMND_SYSLOG "\":%d,\"" D_CMND_LOGHOST "\":\"%s\",\"" D_CMND_LOGPORT "\":%d,\"" D_CMND_SSID "\":[\"%s\",\"%s\"],\"" D_CMND_TELEPERIOD "\":%d,\"" D_CMND_SETOPTION "\":[\"%08X\",\"%08X\",\"%08X\"]}}"),
|
||||||
Settings.seriallog_level, Settings.weblog_level, Settings.syslog_level, Settings.syslog_host, Settings.syslog_port, Settings.sta_ssid[0], Settings.sta_ssid[1], Settings.tele_period, Settings.flag.data, Settings.flag2.data);
|
Settings.seriallog_level, Settings.weblog_level, Settings.syslog_level, Settings.syslog_host, Settings.syslog_port, Settings.sta_ssid[0], Settings.sta_ssid[1], Settings.tele_period, Settings.flag.data, Settings.flag2.data, Settings.flag3.data);
|
||||||
MqttPublishPrefixTopic_P(option, PSTR(D_CMND_STATUS "3"));
|
MqttPublishPrefixTopic_P(option, PSTR(D_CMND_STATUS "3"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,11 +48,11 @@ from StringIO import StringIO
|
|||||||
|
|
||||||
a_on_off = ["OFF","ON "]
|
a_on_off = ["OFF","ON "]
|
||||||
|
|
||||||
a_setoption = [
|
a_setoption = [[
|
||||||
"Save power state and use after restart",
|
"Save power state and use after restart",
|
||||||
"Restrict button actions to single, double and hold",
|
"Restrict button actions to single, double and hold",
|
||||||
"Show value units in JSON messages",
|
"Show value units in JSON messages",
|
||||||
"MQTT",
|
"MQTT enabled",
|
||||||
"Respond as Command topic instead of RESULT",
|
"Respond as Command topic instead of RESULT",
|
||||||
"MQTT retain on Power",
|
"MQTT retain on Power",
|
||||||
"MQTT retain on Button",
|
"MQTT retain on Button",
|
||||||
@ -74,13 +74,24 @@ a_setoption = [
|
|||||||
"MQTT serial",
|
"MQTT serial",
|
||||||
"Rules until 5.14.0b",
|
"Rules until 5.14.0b",
|
||||||
"Rules once mode until 5.14.0b",
|
"Rules once mode until 5.14.0b",
|
||||||
"KNX",
|
"KNX enabled",
|
||||||
"Use Power device index on single relay devices",
|
"Use Power device index on single relay devices",
|
||||||
"KNX enhancement",
|
"KNX enhancement",
|
||||||
"RF receive decimal",
|
"RF receive decimal",
|
||||||
"IR receive decimal",
|
"IR receive decimal",
|
||||||
"Enforce HASS light group",
|
"Enforce HASS light group",
|
||||||
"Do not show Wifi and Mqtt state using Led"]
|
"Do not show Wifi and Mqtt state using Led"
|
||||||
|
],[
|
||||||
|
"Timers enabled",
|
||||||
|
"","","",
|
||||||
|
"","","","",
|
||||||
|
"","","","",
|
||||||
|
"","","","",
|
||||||
|
"","","","",
|
||||||
|
"","","","",
|
||||||
|
"","","","",
|
||||||
|
"","","",""
|
||||||
|
]]
|
||||||
|
|
||||||
a_features = [[
|
a_features = [[
|
||||||
"","","USE_I2C","USE_SPI",
|
"","","USE_I2C","USE_SPI",
|
||||||
@ -144,6 +155,8 @@ else:
|
|||||||
fp.close()
|
fp.close()
|
||||||
|
|
||||||
def StartDecode():
|
def StartDecode():
|
||||||
|
print ("\n*** decode-status.py v20180725 by Theo Arends ***")
|
||||||
|
|
||||||
# print("Decoding\n{}".format(obj))
|
# print("Decoding\n{}".format(obj))
|
||||||
|
|
||||||
if ("StatusSNS" in obj):
|
if ("StatusSNS" in obj):
|
||||||
@ -152,17 +165,29 @@ def StartDecode():
|
|||||||
|
|
||||||
if ("Status" in obj):
|
if ("Status" in obj):
|
||||||
if ("FriendlyName" in obj["Status"]):
|
if ("FriendlyName" in obj["Status"]):
|
||||||
print("\nDecoding information for device {}{}".format(obj["Status"]["FriendlyName"][0], time))
|
print("Decoding information for device {}{}".format(obj["Status"]["FriendlyName"][0], time))
|
||||||
|
|
||||||
if ("StatusLOG" in obj):
|
if ("StatusLOG" in obj):
|
||||||
if ("SetOption" in obj["StatusLOG"]):
|
if ("SetOption" in obj["StatusLOG"]):
|
||||||
options = []
|
options = []
|
||||||
option = obj["StatusLOG"]["SetOption"][0]
|
o = 0
|
||||||
|
p = 0
|
||||||
|
|
||||||
|
r = 1
|
||||||
|
if (len(obj["StatusLOG"]["SetOption"]) == 3):
|
||||||
|
r = 2
|
||||||
|
|
||||||
|
for f in range(r):
|
||||||
|
if (f == 1):
|
||||||
|
o = 2
|
||||||
|
p = 50
|
||||||
|
|
||||||
|
option = obj["StatusLOG"]["SetOption"][o]
|
||||||
i_option = int(option,16)
|
i_option = int(option,16)
|
||||||
for i in range(len(a_setoption)):
|
for i in range(len(a_setoption[f])):
|
||||||
if (a_setoption[i]):
|
if (a_setoption[f][i]):
|
||||||
state = (i_option >> i) & 1
|
state = (i_option >> i) & 1
|
||||||
options.append(str("{0:2d} ({1}) {2}".format(i, a_on_off[state], a_setoption[i])))
|
options.append(str("{0:2d} ({1}) {2}".format(i + p, a_on_off[state], a_setoption[f][i])))
|
||||||
|
|
||||||
print("\nOptions")
|
print("\nOptions")
|
||||||
for i in range(len(options)):
|
for i in range(len(options)):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user