mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-27 04:36:31 +00:00
parent
8501d5568e
commit
a1fc5d4890
@ -57,7 +57,7 @@ BearSSL::WiFiClientSecure_light *telegramClient = nullptr;
|
|||||||
static const uint8_t Telegram_Fingerprint[] PROGMEM = USE_TELEGRAM_FINGERPRINT;
|
static const uint8_t Telegram_Fingerprint[] PROGMEM = USE_TELEGRAM_FINGERPRINT;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
String message[3][6]; // amount of messages read per time (update_id, name_id, name, lastname, chat_id, text)
|
String message[3][6]; // Amount of messages read per time (update_id, name_id, name, lastname, chat_id, text)
|
||||||
uint8_t state = 0;
|
uint8_t state = 0;
|
||||||
uint8_t index = 0;
|
uint8_t index = 0;
|
||||||
uint8_t retry = 0;
|
uint8_t retry = 0;
|
||||||
@ -67,6 +67,7 @@ struct {
|
|||||||
bool recv_enable = false;
|
bool recv_enable = false;
|
||||||
bool echo_enable = false;
|
bool echo_enable = false;
|
||||||
bool recv_busy = false;
|
bool recv_busy = false;
|
||||||
|
bool skip = true; // Skip first telegram if restarted
|
||||||
} Telegram;
|
} Telegram;
|
||||||
|
|
||||||
bool TelegramInit(void) {
|
bool TelegramInit(void) {
|
||||||
@ -172,7 +173,7 @@ void TelegramGetUpdates(String offset) {
|
|||||||
// }
|
// }
|
||||||
// ]}
|
// ]}
|
||||||
|
|
||||||
// AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("TGM: Response %s"), response.c_str());
|
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("TGM: Response %s"), response.c_str());
|
||||||
|
|
||||||
// parsing of reply from Telegram into separate received messages
|
// parsing of reply from Telegram into separate received messages
|
||||||
int i = 0; //messages received counter
|
int i = 0; //messages received counter
|
||||||
@ -348,6 +349,9 @@ void TelegramLoop(void) {
|
|||||||
Telegram.wait = Telegram.poll;
|
Telegram.wait = Telegram.poll;
|
||||||
Telegram.state++;
|
Telegram.state++;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (Telegram.skip) { // Skip first update as it may be a restart (again)
|
||||||
|
Telegram.skip = false;
|
||||||
} else {
|
} else {
|
||||||
if (Telegram.message[0][0].toInt() && (Telegram.message[Telegram.index][5].length() > 0)) {
|
if (Telegram.message[0][0].toInt() && (Telegram.message[Telegram.index][5].length() > 0)) {
|
||||||
String logging = TelegramExecuteCommand(Telegram.message[Telegram.index][5].c_str());
|
String logging = TelegramExecuteCommand(Telegram.message[Telegram.index][5].c_str());
|
||||||
@ -355,6 +359,7 @@ void TelegramLoop(void) {
|
|||||||
TelegramSendMessage(Telegram.message[Telegram.index][4], logging);
|
TelegramSendMessage(Telegram.message[Telegram.index][4], logging);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Telegram.message[0][0] = ""; // All messages have been replied - reset new messages
|
Telegram.message[0][0] = ""; // All messages have been replied - reset new messages
|
||||||
Telegram.wait = Telegram.poll;
|
Telegram.wait = Telegram.poll;
|
||||||
Telegram.state++;
|
Telegram.state++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user