diff --git a/tasmota/i18n.h b/tasmota/i18n.h index 1002983c2..323203f0c 100644 --- a/tasmota/i18n.h +++ b/tasmota/i18n.h @@ -464,7 +464,7 @@ #define D_CMND_ZIGBEE_RESET "ZigbeeReset" #define D_JSON_ZIGBEE_CC2530 "CC2530" #define D_CMND_ZIGBEEZNPSEND "ZigbeeZNPSend" - #define D_JSON_ZIGBEE_STATUS "ZigbeeStatus" + #define D_JSON_ZIGBEE_STATE "ZigbeeState" #define D_JSON_ZIGBEEZNPRECEIVED "ZigbeeZNPReceived" #define D_JSON_ZIGBEEZNPSENT "ZigbeeZNPSent" #define D_JSON_ZIGBEEZCL_RECEIVED "ZigbeeZCLReceived" diff --git a/tasmota/xdrv_23_zigbee_7_statemachine.ino b/tasmota/xdrv_23_zigbee_7_statemachine.ino index c8ba45717..26d30d032 100644 --- a/tasmota/xdrv_23_zigbee_7_statemachine.ino +++ b/tasmota/xdrv_23_zigbee_7_statemachine.ino @@ -76,7 +76,7 @@ enum Zigbee_StateMachine_Instruction_Set { ZGB_INSTR_8_BYTES = 0x80, ZGB_INSTR_CALL = 0x80, // call a function ZGB_INSTR_LOG, // log a message, if more detailed logging required, call a function - ZGB_INSTR_MQTT_STATUS, // send MQTT status string with code + ZGB_INSTR_MQTT_STATE, // send MQTT status string with code ZGB_INSTR_SEND, // send a ZNP message ZGB_INSTR_WAIT_UNTIL, // wait until the specified message is received, ignore all others ZGB_INSTR_WAIT_RECV, // wait for a message according to the filter @@ -98,7 +98,7 @@ enum Zigbee_StateMachine_Instruction_Set { #define ZI_CALL(f, x) { .i = { ZGB_INSTR_CALL, (x), 0x0000} }, { .p = (const void*)(f) }, #define ZI_LOG(x, m) { .i = { ZGB_INSTR_LOG, (x), 0x0000 } }, { .p = ((const void*)(m)) }, -#define ZI_MQTT_STATUS(x, m) { .i = { ZGB_INSTR_MQTT_STATUS, (x), 0x0000 } }, { .p = ((const void*)(m)) }, +#define ZI_MQTT_STATE(x, m) { .i = { ZGB_INSTR_MQTT_STATE, (x), 0x0000 } }, { .p = ((const void*)(m)) }, #define ZI_ON_RECV_UNEXPECTED(f) { .i = { ZGB_ON_RECV_UNEXPECTED, 0x00, 0x0000} }, { .p = (const void*)(f) }, #define ZI_SEND(m) { .i = { ZGB_INSTR_SEND, sizeof(m), 0x0000} }, { .p = (const void*)(m) }, #define ZI_WAIT_RECV(x, m) { .i = { ZGB_INSTR_WAIT_RECV, sizeof(m), (x)} }, { .p = (const void*)(m) }, @@ -322,7 +322,7 @@ static const Zigbee_Instruction zb_prog[] PROGMEM = { ZI_WAIT(10500) // wait for 10 seconds for Tasmota to stabilize ZI_ON_ERROR_GOTO(50) - //ZI_MQTT_STATUS(ZIGBEE_STATUS_BOOT, "Booting") + //ZI_MQTT_STATE(ZIGBEE_STATUS_BOOT, "Booting") //ZI_LOG(LOG_LEVEL_INFO, "ZIG: rebooting device") ZI_SEND(ZBS_RESET) // reboot cc2530 just in case we rebooted ESP8266 but not cc2530 ZI_WAIT_RECV_FUNC(5000, ZBR_RESET, &Z_Reboot) // timeout 5s @@ -346,7 +346,7 @@ static const Zigbee_Instruction zb_prog[] PROGMEM = { // all is good, we can start ZI_LABEL(ZIGBEE_LABEL_START) // START ZNP App - ZI_MQTT_STATUS(ZIGBEE_STATUS_STARTING, "Configured, starting coordinator") + ZI_MQTT_STATE(ZIGBEE_STATUS_STARTING, "Configured, starting coordinator") //ZI_CALL(&Z_State_Ready, 1) // Now accept incoming messages ZI_ON_ERROR_GOTO(ZIGBEE_LABEL_ABORT) // Z_ZDO:startupFromApp @@ -382,7 +382,7 @@ ZI_SEND(ZBS_STARTUPFROMAPP) // start coordinator //ZI_WAIT_UNTIL(500, ZBR_PERMITJOIN_AREQ_OPEN_FF) ZI_LABEL(ZIGBEE_LABEL_READY) - ZI_MQTT_STATUS(ZIGBEE_STATUS_OK, "Started") + ZI_MQTT_STATE(ZIGBEE_STATUS_OK, "Started") ZI_LOG(LOG_LEVEL_INFO, "ZIG: zigbee device ready, listening...") ZI_CALL(&Z_State_Ready, 1) // Now accept incoming messages ZI_LABEL(ZIGBEE_LABEL_MAIN_LOOP) @@ -390,7 +390,7 @@ ZI_SEND(ZBS_STARTUPFROMAPP) // start coordinator ZI_GOTO(ZIGBEE_LABEL_READY) ZI_LABEL(ZIGBEE_LABEL_PERMIT_JOIN_CLOSE) - //ZI_MQTT_STATUS(ZIGBEE_STATUS_PERMITJOIN_CLOSE, "Disable Pairing mode") + //ZI_MQTT_STATE(ZIGBEE_STATUS_PERMITJOIN_CLOSE, "Disable Pairing mode") ZI_SEND(ZBS_PERMITJOINREQ_CLOSE) // Closing the Permit Join ZI_WAIT_RECV(1000, ZBR_PERMITJOINREQ) //ZI_WAIT_UNTIL(1000, ZBR_PERMITJOIN_AREQ_RSP) // not sure it's useful @@ -398,7 +398,7 @@ ZI_SEND(ZBS_STARTUPFROMAPP) // start coordinator ZI_GOTO(ZIGBEE_LABEL_MAIN_LOOP) ZI_LABEL(ZIGBEE_LABEL_PERMIT_JOIN_OPEN_60) - //ZI_MQTT_STATUS(ZIGBEE_STATUS_PERMITJOIN_OPEN_60, "Enable Pairing mode for 60 seconds") + //ZI_MQTT_STATE(ZIGBEE_STATUS_PERMITJOIN_OPEN_60, "Enable Pairing mode for 60 seconds") ZI_SEND(ZBS_PERMITJOINREQ_OPEN_60) ZI_WAIT_RECV(1000, ZBR_PERMITJOINREQ) //ZI_WAIT_UNTIL(1000, ZBR_PERMITJOIN_AREQ_RSP) // not sure it's useful @@ -406,7 +406,7 @@ ZI_SEND(ZBS_STARTUPFROMAPP) // start coordinator ZI_GOTO(ZIGBEE_LABEL_MAIN_LOOP) ZI_LABEL(ZIGBEE_LABEL_PERMIT_JOIN_OPEN_XX) - //ZI_MQTT_STATUS(ZIGBEE_STATUS_PERMITJOIN_OPEN_XX, "Enable Pairing mode until next boot") + //ZI_MQTT_STATE(ZIGBEE_STATUS_PERMITJOIN_OPEN_XX, "Enable Pairing mode until next boot") ZI_SEND(ZBS_PERMITJOINREQ_OPEN_XX) ZI_WAIT_RECV(1000, ZBR_PERMITJOINREQ) //ZI_WAIT_UNTIL(1000, ZBR_PERMITJOIN_AREQ_RSP) // not sure it's useful @@ -414,7 +414,7 @@ ZI_SEND(ZBS_STARTUPFROMAPP) // start coordinator ZI_GOTO(ZIGBEE_LABEL_MAIN_LOOP) ZI_LABEL(50) // reformat device - ZI_MQTT_STATUS(ZIGBEE_STATUS_RESET_CONF, "Reseting configuration") + ZI_MQTT_STATE(ZIGBEE_STATUS_RESET_CONF, "Reseting configuration") //ZI_LOG(LOG_LEVEL_INFO, "ZIG: zigbee bad configuration of device, doing a factory reset") ZI_ON_ERROR_GOTO(ZIGBEE_LABEL_ABORT) ZI_SEND(ZBS_FACTRES) // factory reset @@ -447,11 +447,11 @@ ZI_SEND(ZBS_STARTUPFROMAPP) // start coordinator ZI_GOTO(ZIGBEE_LABEL_START) ZI_LABEL(ZIGBEE_LABEL_UNSUPPORTED_VERSION) - ZI_MQTT_STATUS(ZIGBEE_STATUS_UNSUPPORTED_VERSION, "Only ZNP 1.2 is currently supported") + ZI_MQTT_STATE(ZIGBEE_STATUS_UNSUPPORTED_VERSION, "Only ZNP 1.2 is currently supported") ZI_GOTO(ZIGBEE_LABEL_ABORT) ZI_LABEL(ZIGBEE_LABEL_ABORT) // Label 99: abort - ZI_MQTT_STATUS(ZIGBEE_STATUS_ABORT, "Abort") + ZI_MQTT_STATE(ZIGBEE_STATUS_ABORT, "Abort") ZI_LOG(LOG_LEVEL_ERROR, "ZIG: Abort") ZI_STOP(ZIGBEE_LABEL_ABORT) }; @@ -608,10 +608,10 @@ void ZigbeeStateMachine_Run(void) { case ZGB_INSTR_LOG: AddLog_P(cur_d8, (char*) cur_ptr1); break; - case ZGB_INSTR_MQTT_STATUS: - Response_P(PSTR("{\"" D_JSON_ZIGBEE_STATUS "\":{\"Status\":%d,\"Message\":\"%s\"}}"), + case ZGB_INSTR_MQTT_STATE: + Response_P(PSTR("{\"" D_JSON_ZIGBEE_STATE "\":{\"Status\":%d,\"Message\":\"%s\"}}"), cur_d8, (char*) cur_ptr1); - MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_ZIGBEE_STATUS)); + MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_ZIGBEE_STATE)); XdrvRulesProcess(); break; case ZGB_INSTR_SEND: diff --git a/tasmota/xdrv_23_zigbee_8_parsers.ino b/tasmota/xdrv_23_zigbee_8_parsers.ino index 83c9af5ca..22cebd21c 100644 --- a/tasmota/xdrv_23_zigbee_8_parsers.ino +++ b/tasmota/xdrv_23_zigbee_8_parsers.ino @@ -35,7 +35,7 @@ int32_t Z_ReceiveDeviceInfo(int32_t res, class SBuffer &buf) { char hex[20]; Uint64toHex(long_adr, hex, 64); - Response_P(PSTR("{\"" D_JSON_ZIGBEE_STATUS "\":{" + Response_P(PSTR("{\"" D_JSON_ZIGBEE_STATE "\":{" "\"Status\":%d,\"IEEEAddr\":\"%s\",\"ShortAddr\":\"0x%04X\"" ",\"DeviceType\":%d,\"DeviceState\":%d" ",\"NumAssocDevices\":%d"), @@ -55,7 +55,7 @@ int32_t Z_ReceiveDeviceInfo(int32_t res, class SBuffer &buf) { ResponseJsonEnd(); // append '}' ResponseJsonEnd(); // append '}' - MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_ZIGBEE_STATUS)); + MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_ZIGBEE_STATE)); XdrvRulesProcess(); return res; @@ -90,13 +90,13 @@ int32_t Z_Reboot(int32_t res, class SBuffer &buf) { if (reason > 3) { reason = 3; } GetTextIndexed(reason_str, sizeof(reason_str), reason, Z_RebootReason); - Response_P(PSTR("{\"" D_JSON_ZIGBEE_STATUS "\":{" + Response_P(PSTR("{\"" D_JSON_ZIGBEE_STATE "\":{" "\"Status\":%d,\"Message\":\"%s\",\"RestartReason\":\"%s\"" ",\"MajorRel\":%d,\"MinorRel\":%d}}"), ZIGBEE_STATUS_BOOT, "CC2530 booted", reason_str, major_rel, minor_rel); - MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_ZIGBEE_STATUS)); + MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_ZIGBEE_STATE)); XdrvRulesProcess(); if ((0x02 == major_rel) && (0x06 == minor_rel)) { @@ -121,13 +121,13 @@ int32_t Z_ReceiveCheckVersion(int32_t res, class SBuffer &buf) { uint8_t maint_rel = buf.get8(6); uint32_t revision = buf.get32(7); - Response_P(PSTR("{\"" D_JSON_ZIGBEE_STATUS "\":{" + Response_P(PSTR("{\"" D_JSON_ZIGBEE_STATE "\":{" "\"Status\":%d,\"MajorRel\":%d,\"MinorRel\":%d" ",\"MaintRel\":%d,\"Revision\":%d}}"), ZIGBEE_STATUS_CC_VERSION, major_rel, minor_rel, maint_rel, revision); - MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_ZIGBEE_STATUS)); + MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_ZIGBEE_STATE)); XdrvRulesProcess(); if ((0x02 == major_rel) && (0x06 == minor_rel)) { @@ -162,13 +162,13 @@ int32_t Z_ReceivePermitJoinStatus(int32_t res, const class SBuffer &buf) { status_code = ZIGBEE_STATUS_PERMITJOIN_CLOSE; message = PSTR("Disable Pairing mode"); } - Response_P(PSTR("{\"" D_JSON_ZIGBEE_STATUS "\":{" + Response_P(PSTR("{\"" D_JSON_ZIGBEE_STATE "\":{" "\"Status\":%d,\"Message\":\""), status_code); ResponseAppend_P(message, duration); ResponseAppend_P(PSTR("\"}}")); - MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_ZIGBEE_STATUS)); + MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_ZIGBEE_STATE)); XdrvRulesProcess(); return -1; } @@ -217,7 +217,7 @@ int32_t Z_ReceiveNodeDesc(int32_t res, const class SBuffer &buf) { if (deviceType > 3) { deviceType = 3; } bool complexDescriptorAvailable = (logicalType & 0x08) ? 1 : 0; - Response_P(PSTR("{\"" D_JSON_ZIGBEE_STATUS "\":{" + Response_P(PSTR("{\"" D_JSON_ZIGBEE_STATE "\":{" "\"Status\":%d,\"NodeType\":\"%s\",\"ComplexDesc\":%s}}"), ZIGBEE_STATUS_NODE_DESC, Z_DeviceType[deviceType], complexDescriptorAvailable ? "true" : "false" @@ -247,7 +247,7 @@ int32_t Z_ReceiveActiveEp(int32_t res, const class SBuffer &buf) { Z_SendSimpleDescReq(nwkAddr, activeEpList[i]); } - Response_P(PSTR("{\"" D_JSON_ZIGBEE_STATUS "\":{" + Response_P(PSTR("{\"" D_JSON_ZIGBEE_STATE "\":{" "\"Status\":%d,\"ActiveEndpoints\":["), ZIGBEE_STATUS_ACTIVE_EP); for (uint32_t i = 0; i < activeEpCount; i++) { @@ -305,7 +305,7 @@ int32_t Z_ReceiveSimpleDesc(int32_t res, const class SBuffer &buf) { zigbee_devices.addCluster(nwkAddr, endpoint, buf.get16(16 + numInCluster*2 + i*2), true); } - Response_P(PSTR("{\"" D_JSON_ZIGBEE_STATUS "\":{" + Response_P(PSTR("{\"" D_JSON_ZIGBEE_STATE "\":{" "\"Status\":%d,\"Endpoint\":\"0x%02X\"" ",\"ProfileId\":\"0x%04X\",\"DeviceId\":\"0x%04X\",\"DeviceVersion\":%d" "\"InClusters\":["), @@ -342,7 +342,7 @@ int32_t Z_ReceiveEndDeviceAnnonce(int32_t res, const class SBuffer &buf) { char hex[20]; Uint64toHex(ieeeAddr, hex, 64); - Response_P(PSTR("{\"" D_JSON_ZIGBEE_STATUS "\":{" + Response_P(PSTR("{\"" D_JSON_ZIGBEE_STATE "\":{" "\"Status\":%d,\"IEEEAddr\":\"%s\",\"ShortAddr\":\"0x%04X\"" ",\"PowerSource\":%s,\"ReceiveWhenIdle\":%s,\"Security\":%s}}"), ZIGBEE_STATUS_DEVICE_ANNOUNCE, hex, nwkAddr, @@ -402,7 +402,7 @@ int32_t Z_ReceiveAfIncomingMessage(int32_t res, const class SBuffer &buf) { zcl_received.postProcessAttributes(srcaddr, json); // Add linkquality - json[F(D_CMND_ZIGBEE_LINKQUALITY)] = linkquality; // prefix with underscore for metadata + json[F(D_CMND_ZIGBEE_LINKQUALITY)] = linkquality; msg = ""; json_root.printTo(msg);