jameszah / ESP32-CAM-Telegram

Demo of sending a photo from a ESP32-CAM acting as a Telegram BOT
9 stars 2 forks source link

ESP-EYE #1

Open jimthedj65 opened 3 years ago

jimthedj65 commented 3 years ago

Hi and Thanks for the code, I have been having a lot of issues trying to get this working. Thanks for fixing the bugs.. I uploaded the sketch for ESP32-Cam2.ino etc which loads fine. When it connects to my WiFi it comes up the following error in the serial monitor

WiFi connected IP address: 192.168.3.106 GET Update Messages [BOT]Connecting to server [BOT]Conection error Received empty string in response! GET Update Messages [BOT]Connecting to server [BOT]Conection error Received empty string in response! GET Update Messages [BOT]Connecting to server [BOT]Conection error

I ran a curl test on the bot and the api is all working fine?

Any ideas as to what it could be ?

jimthedj65 commented 3 years ago

the curl test I use to send test messages to my bot is below and messages go through without any issue.

curl https://api.telegram.org/bot**MYID**/sendMessage\?chat_id\=-MY~**GROUPID**\&text\=Helo+World

jimthedj65 commented 3 years ago

I tried cam5 as a last resort and it worked, it was able to connect to my bot.

jameszah commented 3 years ago

Do you have this line client.setInsecure(); in setup???

The messages say you cannot connect to the telegram server. (connection zero, received empty string)

You could set the board to wrover module, and turn on wifi debug messages to see what is happening.

image

jameszah commented 3 years ago

My mods are not in the Brian Lough library yet -- just in my local copy of it -- with the cam5 program.

jimthedj65 commented 3 years ago

ahh ok I misunderstood your library. This is the first time I managed to get this working, thanks for the quick replies.

jimthedj65 commented 3 years ago

Hi there and good morning. Do you know how to adjust the photos sensor, its either too bright or too dark?

jameszah commented 3 years ago

https://randomnerdtutorials.com/esp32-cam-ov2640-camera-settings/

sensor_t * s = esp_camera_sensor_get()

s->set_brightness(s, 0); // -2 to 2 s->set_contrast(s, 0); // -2 to 2 s->set_saturation(s, 0); // -2 to 2 s->set_special_effect(s, 0); // 0 to 6 (0 - No Effect, 1 - Negative, 2 - Grayscale, 3 - Red Tint, 4 - Green Tint, 5 - Blue Tint, 6 - Sepia) s->set_whitebal(s, 1); // 0 = disable , 1 = enable s->set_awb_gain(s, 1); // 0 = disable , 1 = enable

etc.

jimthedj65 commented 3 years ago

hey just got time to get back thank you for the reply, I will try this.

ne0c0de commented 2 years ago

I suggest you tu use this line in setup function:

client.setCACert(TELEGRAM_CERTIFICATE_ROOT); // Add root certificate for api.telegram.org

But even use this code I still can't send photos. The debug line stuck like this:

17:50:13.215 -> Sending UXGA
17:50:13.290 -> 
17:50:13.290 -> >>>>> Sending as 512 byte blocks, with jzdelay of 0, bytes=  145286
17:50:13.290 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 6 bytes...
17:50:13.290 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 58 bytes...
17:50:13.290 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 9 bytes...
17:50:13.328 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 2 bytes...
17:50:13.328 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 22 bytes...
17:50:13.328 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 2 bytes...
17:50:13.328 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 23 bytes...
17:50:13.328 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 2 bytes...
17:50:13.328 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 11 bytes...
17:50:13.364 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 2 bytes...
17:50:13.364 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 16 bytes...
17:50:13.364 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 6 bytes...
17:50:13.364 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 2 bytes...
17:50:13.364 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 44 bytes...
17:50:13.399 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 40 bytes...
17:50:13.399 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 2 bytes...
17:50:13.399 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 0 bytes...

also QVGA not working too:

17:49:10.661 -> Sending QVGA
17:49:10.696 -> 
17:49:10.696 -> >>>>> Sending as 512 byte blocks, with jzdelay of 0, bytes=  12169
17:49:10.696 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 6 bytes...
17:49:10.696 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 58 bytes...
17:49:10.696 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 9 bytes...
17:49:10.696 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 2 bytes...
17:49:10.696 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 22 bytes...
17:49:10.734 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 2 bytes...
17:49:10.734 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 23 bytes...
17:49:10.734 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 2 bytes...
17:49:10.734 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 11 bytes...
17:49:10.734 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 2 bytes...
17:49:10.734 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 16 bytes...
17:49:10.771 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 5 bytes...
17:49:10.771 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 2 bytes...
17:49:10.771 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 44 bytes...
17:49:10.771 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 40 bytes...
17:49:10.771 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 2 bytes...
17:49:10.807 -> [V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 0 bytes...
jameszah commented 2 years ago

Hi, here are the changes:

It is caused by arduino-esp32 library updates 1.05, 1.06, .... and 2.0

It is that println with zero length that caused the problem. (Also you can specify the root_certificate, or just use the set-insecure to keep the trouble) It is described here:

https://github.com/witnessmenow/Universal-Arduino-Telegram-Bot/issues/235

and here it is in my video telegram code (copied from Brian Lough before the 1.05 changes)

client->println(); // client->println(F("")); <--- jz 1.05 bug

https://github.com/jameszah/ESP32-CAM-Video-Telegram/blob/1b059b59dd29961eb4e3e1173db8489a2ce26b5e/UniversalTelegramBot.cpp#L397

... and in the cam-telegram code here:

https://github.com/jameszah/ESP32-CAM-Telegram/blob/c68dd9e3fdde6141e0e04c1d878569192fc56c90/UniversalTelegramBot.cpp#L256