Closed majeka closed 3 years ago
Hello Majeka, Thank you for using the library. I'm trying to replicate tour issue. As you said, there is no issue regarding the wifi connectivity between the NodeMCU and the WiFi access point, right? Some questions:
Could you enable the debug console, recompile and post the serial log?
You can enable the debug mode by editing the file CTBotDefine.h
located in Arduino\libraries\CTBot\src
(Windows platform) and editing the line
// enable debugmode -> print debug data on the Serial; Zero -> debug disabled
#define CTBOT_DEBUG_MODE CTBOT_DEBUG_DISABLED
in
// enable debugmode -> print debug data on the Serial; Zero -> debug disabled
#define CTBOT_DEBUG_MODE CTBOT_DEBUG_ALL
Thanks,
Stefano
Hello! Yes, the connection to the Wi-Fi is carried out, api.telegram.org responds without problems. The library version is installed 2.1.4. Installed v3.0.0, no changes. ArduinoJson version 6.17.2 NodeMCU board with ESP8266 module Magazine on library version 3.0.0 further:
12:51:14.173 -> --->connect: Connecting to maj1................. 12:51:24.539 -> --->connect: WiFi connected 12:51:24.539 -> --->connect: IP address: 192.168.43.65 12:51:24.743 -> --->connect: Unable to connect to Telegram server 12:51:24.743 -> --->sendCommand: Header 12:51:24.777 -> POST /bot551507423:AAFhlLqfg2o52KbUGGaOTqo-uX0SDwto6IU/getMe HTTP/1.1 12:51:24.777 -> Host: api.telegram.org 12:51:24.777 -> Content-Length: 5 12:51:24.777 -> Content-Type: application/json 12:51:24.777 -> 12:51:24.777 -> 12:51:24.777 -> --->sendCommand: Payload 12:51:24.777 -> null 12:51:24.777 -> 12:51:24.777 -> testConnection NOK 12:51:24.948 -> --->connect: Unable to connect to Telegram server 12:51:24.948 -> --->sendCommand: Header 12:51:24.948 -> POST /bot551507423:AAFhlLqfg2o52KbUGGaOTqo-uX0SDwto6IU/getUpdates HTTP/1.1 12:51:24.948 -> Host: api.telegram.org 12:51:24.948 -> Content-Length: 76 12:51:24.948 -> Content-Type: application/json 12:51:24.948 -> 12:51:24.948 -> 12:51:24.948 -> --->sendCommand: Payload 12:51:24.948 -> {"limit":1,"allowed_updates":"[\"message\",\"callback_query\"]","offset":0} 12:51:28.654 -> --->connect: Unable to connect to Telegram server 12:51:28.654 -> --->sendCommand: Header 12:51:28.654 -> POST /bot551507423:AAFhlLqfg2o52KbUGGaOTqo-uX0SDwto6IU/getUpdates HTTP/1.1 12:51:28.654 -> Host: api.telegram.org 12:51:28.688 -> Content-Length: 76 12:51:28.688 -> Content-Type: application/json
Hello,
from the log, the problem is located in the CTBotSecureConnection::connect()
method. The message "--->connect: Unable to connect to Telegram server
" is printed out when something go wrong when the ESP8266 try to establish a connection to the telegram server.
Try to:
Tools
- Erase Flash
- All Flash Contents
and upload the sketch one more time)CTBot
method useDNS(false)
in the setup stage, in order to use the Telegram Server IP instead of the URL. BTW, which is the ESP8266 toolchain version? The last from Espressif is the 2.7.4
Cheers,
Stefano
Hey! The connection is by ip, for this I wrote the designation in the output. 10:53:17.835 -> --->connect: Unable to connect to Telegram server for IP I tried 3 different access points, 2 of them are mobile Internet with different operators. Clearing memory before uploading the sketch helped nothing. Espressif version is the 2.7.4
What other tips can there be to fix this error?
10:53:09.274 -> --->connect: Connecting to majeka1............. 10:53:17.631 -> --->connect: WiFi connected 10:53:17.631 -> --->connect: IP address: 192.168.43.244 10:53:17.835 -> --->connect: Unable to connect to Telegram server for IP 10:53:17.835 -> --->sendCommand: Header 10:53:17.835 -> POST /bot570620331:AAG3vk8lhM_joW5M5bdAzBXrmRT01Oexp2o/getMe HTTP/1.1 10:53:17.835 -> Host: api.telegram.org 10:53:17.835 -> Content-Length: 5 10:53:17.835 -> Content-Type: application/json 10:53:17.835 -> 10:53:17.835 -> 10:53:17.835 -> --->sendCommand: Payload 10:53:17.835 -> null 10:53:17.835 -> 10:53:17.835 -> testConnection NOK 10:53:18.005 -> --->connect: Unable to connect to Telegram server for IP 10:53:18.005 -> --->sendCommand: Header 10:53:18.005 -> POST /bot570620331:AAG3vk8lhM_joW5M5bdAzBXrmRT01Oexp2o/getUpdates HTTP/1.1 10:53:18.005 -> Host: api.telegram.org 10:53:18.005 -> Content-Length: 76 10:53:18.005 -> Content-Type: application/json 10:53:18.005 -> 10:53:18.005 -> 10:53:18.005 -> --->sendCommand: Payload 10:53:18.039 -> {"limit":1,"allowed_updates":"[\"message\",\"callback_query\"]","offset":0} 10:53:21.706 -> --->connect: Unable to connect to Telegram server for IP 10:53:21.706 -> --->sendCommand: Header 10:53:21.740 -> POST /bot570620331:AAG3vk8lhM_joW5M5bdAzBXrmRT01Oexp2o/getUpdates HTTP/1.1 10:53:21.740 -> Host: api.telegram.org 10:53:21.740 -> Content-Length: 76 10:53:21.740 -> Content-Type: application/json
I found out what the problem is, in Espressif version 2.7.4 Installed version 2.7.3 and everything started working. I do not know what was changed there, but it does not work for me on the latest version. Does everything work correctly for you on 2.7.4?
That's very weird! I'm using the 2.7.4 without any issue. Maybe could you do another test please? Remove the Esp8266 library, do a fresh install of the 2.7.4 version and try to recompile the sketch.
Thank you for your feedback!
Cheers, Stefano
Edit: I did this procedure:
and still works.
After a fresh installation of version 2.7.4, everything works correctly as on 2.7.3 Very strange...
Glad to hear that! Maybe something in the previous installation was corrupted or not updated correctly. BTW now all works correctly, thanks for the feedback! Could we close this issue?
Cheers, Stefano
Thank you very much for your support and help in solving my problem, as well as for such a library. It works great.
Hello! The chat bot stopped working. NodeMCU board Previously, everything worked without problems, but two days ago it stopped working. I take any of the examples, for example inlineKeyboard and get 18: 48: 17.638 -> testConnection NOK The address is pinged from the board without problems
19: 01: 55.296 -> Pinging api.telegram.org 19: 01: 55.432 -> Reply from 149.154.167.220: bytes = 32 time = 78ms TTL = 52 19: 01: 56.417 -> Reply from 149.154.167.220: bytes = 32 time = 77ms TTL = 52 19: 01: 57.437 -> Reply from 149.154.167.220: bytes = 32 time = 72ms TTL = 52 19: 01: 58.428 -> Reply from 149.154.167.220: bytes = 32 time = 83ms TTL = 52 19: 01: 59.347 -> Ping statistics for 149.154.167.220: 19: 01: 59.347 -> Packets: Sent = 4, Received = 4, Lost = 0 (0.00% loss), 19: 01: 59.347 -> Approximate round trip times in milli-seconds: 19: 01: 59.347 -> Minimum = 72ms, Maximum = 83ms, Average = 77.50ms 19: 01: 59.381 -> Destination host data: 19: 01: 59.381 -> IP address: 149.154.167.220 19: 01: 59.381 -> DNS name: api.telegram.org
I tried all the examples of the library, none of them worked. I changed the bot token, used different bots, it still doesn't work. Please help with the solution.