-
Notifications
You must be signed in to change notification settings - Fork 53
No message received with Code similar to Echo example #35
Description
Hi there, I need some help. I've coded something thats very similar to the Echo example. The only major thing i changed is that i send a custom message as soon as the ESP gets power.
I checked the IDs and stuff multiple times.
Here is the code:
#include <TelegramBot.h>
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
//------- WiFi Settings -------
const char* ssid = "epiCS-AP";
const char* password = "Password";
// ------- Telegram config --------
const char BotToken[] = "Token";
const char chat_id[] = "ID";
// SSL client
WiFiClientSecure net_ssl;
TelegramBot bot (BotToken, net_ssl);
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
while(!Serial)
// Attempt to connect to Wifi network:
Serial.print("Connecting Wifi: ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(500);
}
Serial.println("");
Serial.println("WiFi connected");
bot.begin();
Serial.println("START");
}
void loop() {
Serial.println("ALERT");
delay(2000);
Serial.println("STILL ALERT");
String message = "EINSATZ!";
if(bot.sendMessage(chat_id, message)){
Serial.println("TELEGRAM Successfully sent");
}
else{
Serial.println("TELEGRAM NOT Successfully sent");
}
delay(300000);
}
And here is the Serial output:
epiCS-AP
..................
WiFi connected
START
ALERT
STILL ALERT
TELEGRAM Successfully sent
I don't understand why it doesn't work, but maybe you have a clue.