Closed chromoxdor closed 2 years ago
Turn on all the debug serial.print statements, and it will step you through the problem.
Could be firewall, or telegram server gets busy sometimes.
Thank you for your quick answer. I did this:
//unmark following line to enable debug mode
#define _debug
didn´t work
since i am not the brightest star in the universe i don´t really know what you mean by that:
Turn on all the debug serial.print statements, and it will step you through the problem.
Could be firewall, or telegram server gets busy sometimes.
right, do that, plus recompile, try it again, and look at the serial port for messages ...
...like you see here "connecting to server" ... or messages about things not working ...
Take the "//" off that line getFreeHeap, and see what it prints out
Something will be printed to lead you to the problem.
#ifdef _debug
Serial.println(F("[BOT Client]Connecting to server"));
#endif
if (!client->connect(HOST, SSL_PORT)) {
#ifdef _debug
Serial.println(F("[BOT Client]Conection error"));
#endif
}
}
if (client->connected()) {
String start_request = "";
String end_request = "";
//Serial.print("Start: "); Serial.println(ESP.getFreeHeap());
This is what i get regarding telegram:
Taking a picture for telegram...
Sending Photo Telegram, bytes: 6947
Send_photo heap before: 90748
[BOT Client]Connecting to server
[BOT Client]Conection error
Send_photo heap after : 90748
Photo telegram failed ><
As mentioned before with an example provided by the Universal Arduino Telegram Bot library it works and Host (api.telegram.org) and Port (443) are the same as in your code so i think i can rule out my internet connection as a problem.
Any suggestions?
Might be a arduino esp32 library version. I haven't tried that with current library version 1.05, which is about a week old. You could try switching back to 1.04 - in Manage Libraries - and select the version.
Or then it is just the one line of code
`if (!client->connect(HOST, SSL_PORT)) {`
So you could switch to Board Wrover module, and turn on Verbose debugging, and you should see a dozen messages from the WiFi system as it is trying to establish the SSL connection.
Come to think of it, I think 1.05 added a setInsecure() function to be compatible with 8266. So try this:
Existing code:
UniversalTelegramBot::UniversalTelegramBot(String token, Client &client) {
_token = token;
#ifdef ARDUINO_ESP8266_RELEASE_2_5_0
//client->setInsecure();
#endif
this->client = &client;
}
New code:
UniversalTelegramBot::UniversalTelegramBot(String token, Client &client) {
_token = token;
client->setInsecure();
this->client = &client;
}
Otherwise you have to get a fancy signature or something to confirm api.telegram.org is not a fake api.telegram.org, but we are not doing banking here!
Also, free up some space on that sd card - it says 81% full, but there might be broken files filling up a bunch of the unused space.
Might be a arduino esp32 library version. I haven't tried that with current library version 1.05, which is about a week old. You could try switching back to 1.04 - in Manage Libraries - and select the version.
This did the trick for me! Thank you very much!!!
Also, free up some space on that sd card - it says 81% full, but there might be broken files filling up a bunch of the unused space.
I did :)
I recommend you for use this package https://github.com/witnessmenow/Universal-Arduino-Telegram-Bot/blob/master/examples/ESP32/SendPhoto/ESP32-Cam/ESP32-Cam.ino
Tried v98 and also v98-wifiman but i get an error when the esp32 tries to send a picture.
Heres the serial output:
I testet my token and id with a example provided by the Universal Arduino Telegram Bot library and it worked.