mirror of https://github.com/arendst/Tasmota.git
Merge pull request #8878 from s-hadinger/zigbee_july_10
Zigbee EZSP better support for groups
This commit is contained in:
commit
535d435f1f
|
@ -509,6 +509,7 @@
|
|||
#define D_CMND_ZIGBEEZNPRECEIVE "ZNPReceive" // only for debug
|
||||
#define D_CMND_ZIGBEE_EZSP_RECEIVE "EZSPReceive" // only for debug
|
||||
#define D_CMND_ZIGBEE_EZSP_RECEIVE_RAW "EZSPReceiveRaw" // only for debug
|
||||
#define D_CMND_ZIGBEE_EZSP_LISTEN "Listen" // only for EZSP
|
||||
#define D_CMND_ZIGBEEZNPSEND "ZNPSend"
|
||||
#define D_CMND_ZIGBEE_EZSP_SEND "EZSPSend"
|
||||
#define D_CMND_ZIGBEE_EZSP_SEND_RAW "EZSPSendRaw"
|
||||
|
|
|
@ -427,7 +427,9 @@ enum EZSP_EmberOutgoingMessageType {
|
|||
EMBER_OUTGOING_VIA_ADDRESS_TABLE = 0x01,
|
||||
EMBER_OUTGOING_VIA_BINDING = 0x02,
|
||||
EMBER_OUTGOING_MULTICAST = 0x03,
|
||||
EMBER_OUTGOING_BROADCAST = 0x04
|
||||
EMBER_OUTGOING_MULTICAST_WITH_ALIAS = 0x04,
|
||||
EMBER_OUTGOING_BROADCAST_WITH_ALIAS = 0x05,
|
||||
EMBER_OUTGOING_BROADCAST = 0x06
|
||||
};
|
||||
|
||||
// inspired from https://github.com/zigpy/zigpy/blob/dev/zigpy/zdo/types.py
|
||||
|
|
|
@ -717,6 +717,8 @@ ZBM(ZBS_SET_POLICY_02, EZSP_setPolicy, 0x00 /*high*/, EZSP_UNICAST_REPLIES_PO
|
|||
EZSP_HOST_WILL_NOT_SUPPLY_REPLY) // 55000220
|
||||
ZBM(ZBS_SET_POLICY_03, EZSP_setPolicy, 0x00 /*high*/, EZSP_POLL_HANDLER_POLICY,
|
||||
EZSP_POLL_HANDLER_IGNORE) // 55000330
|
||||
ZBM(ZBS_SET_POLICY_04, EZSP_setPolicy, 0x00 /*high*/, EZSP_MESSAGE_CONTENTS_IN_CALLBACK_POLICY,
|
||||
EZSP_MESSAGE_TAG_AND_CONTENTS_IN_CALLBACK) // 55000441
|
||||
ZBM(ZBS_SET_POLICY_05, EZSP_setPolicy, 0x00 /*high*/, EZSP_TC_KEY_REQUEST_POLICY,
|
||||
EZSP_ALLOW_TC_KEY_REQUESTS_AND_SEND_CURRENT_KEY) // 55000551
|
||||
ZBM(ZBS_SET_POLICY_06, EZSP_setPolicy, 0x00 /*high*/, EZSP_APP_KEY_REQUEST_POLICY,
|
||||
|
@ -871,6 +873,7 @@ static const Zigbee_Instruction zb_prog[] PROGMEM = {
|
|||
ZI_SEND(ZBS_SET_POLICY_00) ZI_WAIT_RECV(500, ZBR_SET_POLICY_XX)
|
||||
ZI_SEND(ZBS_SET_POLICY_02) ZI_WAIT_RECV(500, ZBR_SET_POLICY_XX)
|
||||
ZI_SEND(ZBS_SET_POLICY_03) ZI_WAIT_RECV(500, ZBR_SET_POLICY_XX)
|
||||
// ZI_SEND(ZBS_SET_POLICY_04) ZI_WAIT_RECV(500, ZBR_SET_POLICY_XX)
|
||||
ZI_SEND(ZBS_SET_POLICY_05) ZI_WAIT_RECV(500, ZBR_SET_POLICY_XX)
|
||||
ZI_SEND(ZBS_SET_POLICY_06) ZI_WAIT_RECV(500, ZBR_SET_POLICY_XX)
|
||||
|
||||
|
|
|
@ -935,6 +935,12 @@ void Z_IncomingMessage(ZCLFrame &zcl_received) {
|
|||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE D_JSON_ZIGBEEZCL_RAW_RECEIVED ": {\"0x%04X\":%s}"), srcaddr, msg.c_str());
|
||||
}
|
||||
|
||||
// discard the message if it was sent by us (broadcast or group loopback)
|
||||
if (srcaddr == localShortAddr) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "loopback message, ignoring"));
|
||||
return; // abort the rest of message management
|
||||
}
|
||||
|
||||
zcl_received.postProcessAttributes(srcaddr, json);
|
||||
// Add Endpoint
|
||||
json[F(D_CMND_ZIGBEE_ENDPOINT)] = srcendpoint;
|
||||
|
|
|
@ -26,7 +26,7 @@ const char kZbCommands[] PROGMEM = D_PRFX_ZB "|" // prefix
|
|||
D_CMND_ZIGBEEZNPSEND "|" D_CMND_ZIGBEEZNPRECEIVE "|"
|
||||
#endif // USE_ZIGBEE_ZNP
|
||||
#ifdef USE_ZIGBEE_EZSP
|
||||
D_CMND_ZIGBEE_EZSP_SEND "|" D_CMND_ZIGBEE_EZSP_RECEIVE "|"
|
||||
D_CMND_ZIGBEE_EZSP_SEND "|" D_CMND_ZIGBEE_EZSP_RECEIVE "|" D_CMND_ZIGBEE_EZSP_LISTEN "|"
|
||||
#endif // USE_ZIGBEE_EZSP
|
||||
D_CMND_ZIGBEE_PERMITJOIN "|"
|
||||
D_CMND_ZIGBEE_STATUS "|" D_CMND_ZIGBEE_RESET "|" D_CMND_ZIGBEE_SEND "|" D_CMND_ZIGBEE_PROBE "|"
|
||||
|
@ -41,7 +41,7 @@ void (* const ZigbeeCommand[])(void) PROGMEM = {
|
|||
&CmndZbZNPSend, &CmndZbZNPReceive,
|
||||
#endif // USE_ZIGBEE_ZNP
|
||||
#ifdef USE_ZIGBEE_EZSP
|
||||
&CmndZbEZSPSend, &CmndZbEZSPReceive,
|
||||
&CmndZbEZSPSend, &CmndZbEZSPReceive, &CmndZbEZSPListen,
|
||||
#endif // USE_ZIGBEE_EZSP
|
||||
&CmndZbPermitJoin,
|
||||
&CmndZbStatus, &CmndZbReset, &CmndZbSend, &CmndZbProbe,
|
||||
|
@ -1024,6 +1024,36 @@ void CmndZbPermitJoin(void) {
|
|||
ResponseCmndDone();
|
||||
}
|
||||
|
||||
#ifdef USE_ZIGBEE_EZSP
|
||||
//
|
||||
// `ZbListen`: add a multicast group to listen to
|
||||
// Overcomes a current limitation that EZSP only shows messages from multicast groups it listens too
|
||||
//
|
||||
// Ex: `ZbListen 99`, `ZbListen2 100`
|
||||
void CmndZbEZSPListen(void) {
|
||||
if (zigbee.init_phase) { ResponseCmndChar_P(PSTR(D_ZIGBEE_NOT_STARTED)); return; }
|
||||
|
||||
int32_t index = XdrvMailbox.index - 1; // 0 based
|
||||
int32_t group = XdrvMailbox.payload;
|
||||
|
||||
if (group <= 0) {
|
||||
group = 0;
|
||||
} else if (group > 0xFFFF) {
|
||||
group = 0xFFFF;
|
||||
}
|
||||
|
||||
SBuffer buf(8);
|
||||
buf.add16(EZSP_setMulticastTableEntry);
|
||||
buf.add8(index);
|
||||
buf.add16(group); // group
|
||||
buf.add8(0x01); // endpoint
|
||||
buf.add8(0x00); // network index
|
||||
ZigbeeEZSPSendCmd(buf.getBuffer(), buf.len(), true);
|
||||
|
||||
ResponseCmndDone();
|
||||
}
|
||||
#endif // USE_ZIGBEE_EZSP
|
||||
|
||||
//
|
||||
// Command `ZbStatus`
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue