diff --git a/tasmota/xdrv_23_zigbee_1_headers.ino b/tasmota/xdrv_23_zigbee_1_headers.ino index 66f43c137..c4283599e 100644 --- a/tasmota/xdrv_23_zigbee_1_headers.ino +++ b/tasmota/xdrv_23_zigbee_1_headers.ino @@ -34,6 +34,7 @@ public: uint16_t manuf; bool clusterSpecific; bool needResponse; + bool direct; // true if direct, false if discover router uint8_t transacId; // ZCL transaction number const uint8_t *msg; size_t len; @@ -86,6 +87,8 @@ struct ZigbeeStatus { ZB_RecvMsgFunc recv_func = nullptr; // function to call when message is expected ZB_RecvMsgFunc recv_unexpected = nullptr; // function called when unexpected message is received + + uint32_t permit_end_time = 0; // timestamp when permit join ends }; struct ZigbeeStatus zigbee; SBuffer *zigbee_buffer = nullptr; diff --git a/tasmota/xdrv_23_zigbee_5_converters.ino b/tasmota/xdrv_23_zigbee_5_converters.ino index 055ca1a88..733a1d45d 100644 --- a/tasmota/xdrv_23_zigbee_5_converters.ino +++ b/tasmota/xdrv_23_zigbee_5_converters.ino @@ -753,6 +753,8 @@ public: void syntheticAqaraCubeOrButton(Z_attribute_list &attr_list, class Z_attribute &attr); void syntheticAqaraVibration(Z_attribute_list &attr_list, class Z_attribute &attr); + // handle read attributes auto-responder + void autoResponder(const uint16_t *attr_list_ids, size_t attr_len); inline void setGroupId(uint16_t groupid) { _groupaddr = groupid; @@ -1182,6 +1184,7 @@ void ZCLFrame::parseReportAttributes(Z_attribute_list& attr_list) { _manuf_code, false /* not cluster specific */, false /* noresponse */, + true /* direct no retry */, _transact_seq, /* zcl transaction id */ buf.getBuffer(), buf.len() })); @@ -1349,7 +1352,7 @@ void ZCLFrame::parseReadAttributes(Z_attribute_list& attr_list) { attr_list.addAttribute(F("ReadNames")).setStrRaw(attr_names.toString(true).c_str()); // call auto-responder - Z_AutoResponder(_srcaddr, _cluster_id, _srcendpoint, read_attr_ids, len/2); + autoResponder(read_attr_ids, len/2); } // ZCL_CONFIGURE_REPORTING_RESPONSE diff --git a/tasmota/xdrv_23_zigbee_6_commands.ino b/tasmota/xdrv_23_zigbee_6_commands.ino index aa85a8def..f3ad8748a 100644 --- a/tasmota/xdrv_23_zigbee_6_commands.ino +++ b/tasmota/xdrv_23_zigbee_6_commands.ino @@ -186,6 +186,7 @@ void Z_ReadAttrCallback(uint16_t shortaddr, uint16_t groupaddr, uint16_t cluster 0, /* manuf */ false /* not cluster specific */, true /* response */, + false /* discover route */, seq, /* zcl transaction id */ attrs, attrs_len })); diff --git a/tasmota/xdrv_23_zigbee_8_parsers.ino b/tasmota/xdrv_23_zigbee_8_parsers.ino index 71097fb63..b6ba038e9 100644 --- a/tasmota/xdrv_23_zigbee_8_parsers.ino +++ b/tasmota/xdrv_23_zigbee_8_parsers.ino @@ -176,7 +176,7 @@ int32_t EZ_PermitJoinRsp(int32_t res, const class SBuffer &buf) { // // Special case: EZSP does not send an event for PermitJoin end, so we generate a synthetic one // -void Z_PermitJoinDisable(uint16_t shortaddr, uint16_t groupaddr, uint16_t cluster, uint8_t endpoint, uint32_t value) { +void Z_PermitJoinDisable(void) { Response_P(PSTR("{\"" D_JSON_ZIGBEE_STATE "\":{\"Status\":20,\"Message\":\"Pairing mode disabled\"}}")); MqttPublishPrefixTopicRulesProcess_P(RESULT_OR_TELE, PSTR(D_JSON_ZIGBEE_STATE)); } @@ -1134,6 +1134,7 @@ void Z_SendDeviceInfoRequest(uint16_t shortaddr) { 0x0000, /* manuf */ false /* not cluster specific */, true /* response */, + false /* discover route */, transacid, /* zcl transaction id */ InfoReq, sizeof(InfoReq) })); @@ -1155,6 +1156,7 @@ void Z_SendSingleAttributeRead(uint16_t shortaddr, uint16_t groupaddr, uint16_t 0x0000, /* manuf */ false /* not cluster specific */, true /* response */, + false /* discover route */, transacid, /* zcl transaction id */ InfoReq, sizeof(InfoReq) })); @@ -1301,6 +1303,7 @@ void Z_AutoConfigReportingForCluster(uint16_t shortaddr, uint16_t groupaddr, uin 0x0000, /* manuf */ false /* not cluster specific */, false /* no response */, + false /* discover route */, zigbee_devices.getNextSeqNumber(shortaddr), /* zcl transaction id */ buf.buf(), buf.len() })); @@ -1779,14 +1782,14 @@ int32_t Z_State_Ready(uint8_t value) { // // Mostly used for routers/end-devices // json: holds the attributes in JSON format -void Z_AutoResponder(uint16_t srcaddr, uint16_t cluster, uint8_t endpoint, const uint16_t *attr_list_ids, size_t attr_len) { +void ZCLFrame::autoResponder(const uint16_t *attr_list_ids, size_t attr_len) { Z_attribute_list attr_list; for (uint32_t i=0; i