mirror of https://github.com/arendst/Tasmota.git
Zigbee long logs
This commit is contained in:
parent
4217880946
commit
f40967c567
|
@ -129,4 +129,16 @@ uint32_t parseHex(const char **data, size_t max_len = 8) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Since v9.2.0.2 Log buffer was reduced from 700 bytes to 120. This version is specific to Zigbee and restores the 700 bytes limit
|
||||||
|
void AddLogZ_P(uint32_t loglevel, PGM_P formatP, ...) {
|
||||||
|
char log_data[MAX_LOGSZ];
|
||||||
|
|
||||||
|
va_list arg;
|
||||||
|
va_start(arg, formatP);
|
||||||
|
vsnprintf_P(log_data, sizeof(log_data), formatP, arg);
|
||||||
|
va_end(arg);
|
||||||
|
|
||||||
|
AddLogData(loglevel, log_data);
|
||||||
|
}
|
||||||
|
|
||||||
#endif // USE_ZIGBEE
|
#endif // USE_ZIGBEE
|
||||||
|
|
|
@ -363,15 +363,15 @@ void ZFS::initOrFormat(void) {
|
||||||
byte map[256];
|
byte map[256];
|
||||||
char hex_char[(256 * 2) + 2];
|
char hex_char[(256 * 2) + 2];
|
||||||
zigbee.eeprom.readBytes(0x0000, 256, map);
|
zigbee.eeprom.readBytes(0x0000, 256, map);
|
||||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "BLK 00 %s"), ToHex_P(map, sizeof(map), hex_char, sizeof(hex_char)));
|
AddLogZ_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "BLK 00 %s"), ToHex_P(map, sizeof(map), hex_char, sizeof(hex_char)));
|
||||||
// zigbee.eeprom.readBytes(0x0100, 256, map);
|
// zigbee.eeprom.readBytes(0x0100, 256, map);
|
||||||
// AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "BLK 01 %s"), ToHex_P(map, sizeof(map), hex_char, sizeof(hex_char)));
|
// AddLogZ_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "BLK 01 %s"), ToHex_P(map, sizeof(map), hex_char, sizeof(hex_char)));
|
||||||
zigbee.eeprom.readBytes(0x0200, 256, map);
|
zigbee.eeprom.readBytes(0x0200, 256, map);
|
||||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "BLK 02 %s"), ToHex_P(map, sizeof(map), hex_char, sizeof(hex_char)));
|
AddLogZ_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "BLK 02 %s"), ToHex_P(map, sizeof(map), hex_char, sizeof(hex_char)));
|
||||||
zigbee.eeprom.readBytes(0x2100, 256, map);
|
zigbee.eeprom.readBytes(0x2100, 256, map);
|
||||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "BLK 21 %s"), ToHex_P(map, sizeof(map), hex_char, sizeof(hex_char)));
|
AddLogZ_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "BLK 21 %s"), ToHex_P(map, sizeof(map), hex_char, sizeof(hex_char)));
|
||||||
// zigbee.eeprom.readBytes(0xFF00, 256, map);
|
// zigbee.eeprom.readBytes(0xFF00, 256, map);
|
||||||
// AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "BLK FF %s"), ToHex_P(map, sizeof(map), hex_char, sizeof(hex_char)));
|
// AddLogZ_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "BLK FF %s"), ToHex_P(map, sizeof(map), hex_char, sizeof(hex_char)));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -742,7 +742,7 @@ public:
|
||||||
if (Settings.flag3.tuya_serial_mqtt_publish) {
|
if (Settings.flag3.tuya_serial_mqtt_publish) {
|
||||||
MqttPublishPrefixTopicRulesProcess_P(TELE, PSTR(D_RSLT_SENSOR));
|
MqttPublishPrefixTopicRulesProcess_P(TELE, PSTR(D_RSLT_SENSOR));
|
||||||
} else {
|
} else {
|
||||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "%s"), TasmotaGlobal.mqtt_data);
|
AddLogZ_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "%s"), TasmotaGlobal.mqtt_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1425,7 +1425,7 @@ void Z_SendCIEZoneEnrollResponse(uint16_t shortaddr, uint16_t groupaddr, uint16_
|
||||||
void Z_AutoBind(uint16_t shortaddr, uint16_t groupaddr, uint16_t cluster, uint8_t endpoint, uint32_t value) {
|
void Z_AutoBind(uint16_t shortaddr, uint16_t groupaddr, uint16_t cluster, uint8_t endpoint, uint32_t value) {
|
||||||
uint64_t srcLongAddr = zigbee_devices.getDeviceLongAddr(shortaddr);
|
uint64_t srcLongAddr = zigbee_devices.getDeviceLongAddr(shortaddr);
|
||||||
|
|
||||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "auto-bind `ZbBind {\"Device\":\"0x%04X\",\"Endpoint\":%d,\"Cluster\":\"0x%04X\"}`"),
|
AddLogZ_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "auto-bind `ZbBind {\"Device\":\"0x%04X\",\"Endpoint\":%d,\"Cluster\":\"0x%04X\"}`"),
|
||||||
shortaddr, endpoint, cluster);
|
shortaddr, endpoint, cluster);
|
||||||
#ifdef USE_ZIGBEE_ZNP
|
#ifdef USE_ZIGBEE_ZNP
|
||||||
SBuffer buf(34);
|
SBuffer buf(34);
|
||||||
|
@ -1550,7 +1550,7 @@ void Z_AutoConfigReportingForCluster(uint16_t shortaddr, uint16_t groupaddr, uin
|
||||||
ResponseAppend_P(PSTR("}}"));
|
ResponseAppend_P(PSTR("}}"));
|
||||||
|
|
||||||
if (buf.len() > 0) {
|
if (buf.len() > 0) {
|
||||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "auto-bind `%s`"), TasmotaGlobal.mqtt_data);
|
AddLogZ_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "auto-bind `%s`"), TasmotaGlobal.mqtt_data);
|
||||||
ZigbeeZCLSend_Raw(ZigbeeZCLSendMessage({
|
ZigbeeZCLSend_Raw(ZigbeeZCLSendMessage({
|
||||||
shortaddr,
|
shortaddr,
|
||||||
0x0000, /* group */
|
0x0000, /* group */
|
||||||
|
@ -1658,7 +1658,7 @@ void Z_IncomingMessage(class ZCLFrame &zcl_received) {
|
||||||
zcl_received.parseClusterSpecificCommand(attr_list);
|
zcl_received.parseClusterSpecificCommand(attr_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE D_JSON_ZIGBEEZCL_RAW_RECEIVED ": {\"0x%04X\":{%s}}"), srcaddr, attr_list.toString().c_str());
|
AddLogZ_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE D_JSON_ZIGBEEZCL_RAW_RECEIVED ": {\"0x%04X\":{%s}}"), srcaddr, attr_list.toString().c_str());
|
||||||
|
|
||||||
// discard the message if it was sent by us (broadcast or group loopback)
|
// discard the message if it was sent by us (broadcast or group loopback)
|
||||||
if (srcaddr == localShortAddr) {
|
if (srcaddr == localShortAddr) {
|
||||||
|
@ -2143,7 +2143,7 @@ void ZCLFrame::autoResponder(const uint16_t *attr_list_ids, size_t attr_len) {
|
||||||
// we have a non-empty output
|
// we have a non-empty output
|
||||||
|
|
||||||
// log first
|
// log first
|
||||||
AddLog_P(LOG_LEVEL_INFO, PSTR("ZIG: Auto-responder: ZbSend {\"Device\":\"0x%04X\""
|
AddLogZ_P(LOG_LEVEL_INFO, PSTR("ZIG: Auto-responder: ZbSend {\"Device\":\"0x%04X\""
|
||||||
",\"Cluster\":\"0x%04X\""
|
",\"Cluster\":\"0x%04X\""
|
||||||
",\"Endpoint\":%d"
|
",\"Endpoint\":%d"
|
||||||
",\"Response\":%s}"
|
",\"Response\":%s}"
|
||||||
|
|
|
@ -156,7 +156,7 @@ void ZigbeeInputLoop(void) {
|
||||||
if (Settings.flag3.tuya_serial_mqtt_publish) {
|
if (Settings.flag3.tuya_serial_mqtt_publish) {
|
||||||
MqttPublishPrefixTopicRulesProcess_P(TELE, PSTR(D_RSLT_SENSOR));
|
MqttPublishPrefixTopicRulesProcess_P(TELE, PSTR(D_RSLT_SENSOR));
|
||||||
} else {
|
} else {
|
||||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "%s"), TasmotaGlobal.mqtt_data);
|
AddLogZ_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "%s"), TasmotaGlobal.mqtt_data);
|
||||||
}
|
}
|
||||||
// now process the message
|
// now process the message
|
||||||
ZigbeeProcessInput(znp_buffer);
|
ZigbeeProcessInput(znp_buffer);
|
||||||
|
@ -267,7 +267,7 @@ void ZigbeeInputLoop(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ToHex_P((unsigned char*)ezsp_buffer.getBuffer(), ezsp_buffer.len(), hex_char, sizeof(hex_char));
|
ToHex_P((unsigned char*)ezsp_buffer.getBuffer(), ezsp_buffer.len(), hex_char, sizeof(hex_char));
|
||||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_ZIGBEE "{\"" D_JSON_ZIGBEE_EZSP_RECEIVED "2\":\"%s\"}"), hex_char);
|
AddLogZ_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_ZIGBEE "{\"" D_JSON_ZIGBEE_EZSP_RECEIVED "2\":\"%s\"}"), hex_char);
|
||||||
// now process the message
|
// now process the message
|
||||||
ZigbeeProcessInputRaw(ezsp_buffer);
|
ZigbeeProcessInputRaw(ezsp_buffer);
|
||||||
}
|
}
|
||||||
|
@ -357,7 +357,7 @@ void ZigbeeZNPSend(const uint8_t *msg, size_t len) {
|
||||||
}
|
}
|
||||||
// Now send a MQTT message to report the sent message
|
// Now send a MQTT message to report the sent message
|
||||||
char hex_char[(len * 2) + 2];
|
char hex_char[(len * 2) + 2];
|
||||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE D_JSON_ZIGBEEZNPSENT " %s"),
|
AddLogZ_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE D_JSON_ZIGBEEZNPSENT " %s"),
|
||||||
ToHex_P(msg, len, hex_char, sizeof(hex_char)));
|
ToHex_P(msg, len, hex_char, sizeof(hex_char)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -491,7 +491,7 @@ void ZigbeeEZSPSendRaw(const uint8_t *msg, size_t len, bool send_cancel) {
|
||||||
|
|
||||||
// Now send a MQTT message to report the sent message
|
// Now send a MQTT message to report the sent message
|
||||||
char hex_char[(len * 2) + 2];
|
char hex_char[(len * 2) + 2];
|
||||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_ZIGBEE D_JSON_ZIGBEE_EZSP_SENT_RAW " %s"),
|
AddLogZ_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_ZIGBEE D_JSON_ZIGBEE_EZSP_SENT_RAW " %s"),
|
||||||
ToHex_P(msg, len, hex_char, sizeof(hex_char)));
|
ToHex_P(msg, len, hex_char, sizeof(hex_char)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,7 +500,7 @@ void ZigbeeEZSPSendRaw(const uint8_t *msg, size_t len, bool send_cancel) {
|
||||||
void ZigbeeEZSPSendCmd(const uint8_t *msg, size_t len) {
|
void ZigbeeEZSPSendCmd(const uint8_t *msg, size_t len) {
|
||||||
char hex_char[len*2 + 2];
|
char hex_char[len*2 + 2];
|
||||||
ToHex_P(msg, len, hex_char, sizeof(hex_char));
|
ToHex_P(msg, len, hex_char, sizeof(hex_char));
|
||||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "ZbEZSPSend %s"), hex_char);
|
AddLogZ_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "ZbEZSPSend %s"), hex_char);
|
||||||
|
|
||||||
SBuffer cmd(len+3); // prefix with seq number (1 byte) and frame control bytes (2 bytes)
|
SBuffer cmd(len+3); // prefix with seq number (1 byte) and frame control bytes (2 bytes)
|
||||||
|
|
||||||
|
@ -607,7 +607,7 @@ void ZigbeeProcessInputEZSP(class SBuffer &buf) {
|
||||||
log_level = LOG_LEVEL_DEBUG;
|
log_level = LOG_LEVEL_DEBUG;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
AddLog_P(log_level, PSTR(D_LOG_ZIGBEE "%s"), TasmotaGlobal.mqtt_data); // TODO move to LOG_LEVEL_DEBUG when stable
|
AddLogZ_P(log_level, PSTR(D_LOG_ZIGBEE "%s"), TasmotaGlobal.mqtt_data); // TODO move to LOG_LEVEL_DEBUG when stable
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pass message to state machine
|
// Pass message to state machine
|
||||||
|
|
|
@ -188,7 +188,7 @@ void zigbeeZCLSendStr(uint16_t shortaddr, uint16_t groupaddr, uint8_t endpoint,
|
||||||
endpoint = zigbee_devices.findFirstEndpoint(shortaddr);
|
endpoint = zigbee_devices.findFirstEndpoint(shortaddr);
|
||||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("ZbSend: guessing endpoint 0x%02X"), endpoint);
|
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("ZbSend: guessing endpoint 0x%02X"), endpoint);
|
||||||
}
|
}
|
||||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("ZbSend: shortaddr 0x%04X, groupaddr 0x%04X, cluster 0x%04X, endpoint 0x%02X, cmd 0x%02X, data %s"),
|
AddLogZ_P(LOG_LEVEL_DEBUG, PSTR("ZbSend: shortaddr 0x%04X, groupaddr 0x%04X, cluster 0x%04X, endpoint 0x%02X, cmd 0x%02X, data %s"),
|
||||||
shortaddr, groupaddr, cluster, endpoint, cmd, param);
|
shortaddr, groupaddr, cluster, endpoint, cmd, param);
|
||||||
|
|
||||||
if ((0 == endpoint) && (BAD_SHORTADDR != shortaddr)) { // endpoint null is ok for group address
|
if ((0 == endpoint) && (BAD_SHORTADDR != shortaddr)) { // endpoint null is ok for group address
|
||||||
|
@ -580,7 +580,7 @@ void ZbSendSend(class JsonParserToken val_cmd, uint16_t device, uint16_t groupad
|
||||||
// we have an unsupported command type, just ignore it and fallback to missing command
|
// we have an unsupported command type, just ignore it and fallback to missing command
|
||||||
}
|
}
|
||||||
|
|
||||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("ZigbeeZCLSend device: 0x%04X, group: 0x%04X, endpoint:%d, cluster:0x%04X, cmd:0x%02X, send:\"%s\""),
|
AddLogZ_P(LOG_LEVEL_DEBUG, PSTR("ZigbeeZCLSend device: 0x%04X, group: 0x%04X, endpoint:%d, cluster:0x%04X, cmd:0x%02X, send:\"%s\""),
|
||||||
device, groupaddr, endpoint, cluster, cmd, cmd_s);
|
device, groupaddr, endpoint, cluster, cmd, cmd_s);
|
||||||
zigbeeZCLSendStr(device, groupaddr, endpoint, clusterSpecific, manuf, cluster, cmd, cmd_s);
|
zigbeeZCLSendStr(device, groupaddr, endpoint, clusterSpecific, manuf, cluster, cmd, cmd_s);
|
||||||
ResponseCmndDone();
|
ResponseCmndDone();
|
||||||
|
|
Loading…
Reference in New Issue