mirror of https://github.com/arendst/Tasmota.git
Rules: Add TuyaMcuReceived#Data=<HexBytesReceived> rule and fix SerialReceived and SSerialRecieved rules
This commit is contained in:
parent
f017c7b6c5
commit
a567226415
|
@ -456,6 +456,7 @@
|
|||
// Commands xdrv_16_tuyadimmer.ino
|
||||
|
||||
#define D_CMND_TUYA_MCU "TuyaMCU"
|
||||
#define D_JSON_TUYA_MCU_RECEIVED "TuyaMcuReceived"
|
||||
|
||||
// Commands xdrv_23_zigbee.ino
|
||||
#define D_CMND_ZIGBEE_PERMITJOIN "ZigbeePermitJoin"
|
||||
|
|
|
@ -1241,7 +1241,7 @@ void SerialInput(void)
|
|||
if (Settings.flag.mqtt_serial && serial_in_byte_counter && (millis() > (serial_polling_window + SERIAL_POLLING))) {
|
||||
serial_in_buffer[serial_in_byte_counter] = 0; // Serial data completed
|
||||
char hex_char[(serial_in_byte_counter * 2) + 2];
|
||||
ResponseTime_P(PSTR(",\"" D_JSON_SERIALRECEIVED "\":\"%s\"}"),
|
||||
Response_P(PSTR(",\"" D_JSON_SERIALRECEIVED "\":\"%s\"}"),
|
||||
(Settings.flag.mqtt_serial_raw) ? ToHex_P((unsigned char*)serial_in_buffer, serial_in_byte_counter, hex_char, sizeof(hex_char)) : serial_in_buffer);
|
||||
MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_SERIALRECEIVED));
|
||||
XdrvRulesProcess();
|
||||
|
|
|
@ -71,7 +71,7 @@ void SerialBridgeInput(void)
|
|||
if (serial_bridge_in_byte_counter && (millis() > (serial_bridge_polling_window + SERIAL_POLLING))) {
|
||||
serial_bridge_buffer[serial_bridge_in_byte_counter] = 0; // Serial data completed
|
||||
char hex_char[(serial_bridge_in_byte_counter * 2) + 2];
|
||||
ResponseTime_P(PSTR(",\"" D_JSON_SSERIALRECEIVED "\":\"%s\"}"),
|
||||
Response_P(PSTR(",\"" D_JSON_SSERIALRECEIVED "\":\"%s\"}"),
|
||||
(serial_bridge_raw) ? ToHex_P((unsigned char*)serial_bridge_buffer, serial_bridge_in_byte_counter, hex_char, sizeof(hex_char)) : serial_bridge_buffer);
|
||||
MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_SSERIALRECEIVED));
|
||||
XdrvRulesProcess();
|
||||
|
|
|
@ -538,12 +538,10 @@ void TuyaSerialInput(void)
|
|||
else if ((Tuya.cmd_status == 3) && (Tuya.byte_counter == (6 + Tuya.data_len)) && (Tuya.cmd_checksum == serial_in_byte)) { // Compare checksum and process packet
|
||||
Tuya.buffer[Tuya.byte_counter++] = serial_in_byte;
|
||||
|
||||
snprintf_P(log_data, sizeof(log_data), PSTR("TYA: RX Packet: \""));
|
||||
for (uint32_t i = 0; i < Tuya.byte_counter; i++) {
|
||||
snprintf_P(log_data, sizeof(log_data), PSTR("%s%02x"), log_data, Tuya.buffer[i]);
|
||||
}
|
||||
snprintf_P(log_data, sizeof(log_data), PSTR("%s\""), log_data);
|
||||
AddLog(LOG_LEVEL_DEBUG);
|
||||
char hex_char[(Tuya.byte_counter * 2) + 2];
|
||||
Response_P(PSTR("{\"" D_JSON_TUYA_MCU_RECEIVED "\":\"%s\"}"), ToHex_P((unsigned char*)Tuya.buffer, Tuya.byte_counter, hex_char, sizeof(hex_char)));
|
||||
MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_TUYA_MCU_RECEIVED));
|
||||
XdrvRulesProcess();
|
||||
|
||||
TuyaPacketProcess();
|
||||
Tuya.byte_counter = 0;
|
||||
|
|
Loading…
Reference in New Issue