Problems with ESP12F
Thanks for this nice library. I’ve tried it on ESP32 and it works well. But with ESP12F (ESP8266) it’s not working. No idea if where is the problem.
i've tried it on the ESP8266 as well, but it doesn't work there, no clue why
Can you provide a sample app that's not working if it produces any relevant error message?
Thanks,
Hi,
Nice Library :-)
I also have tested your library in a ESP8266 (Wemos Lolin D1 Mini Pro) and unfortunately it does not work. I tested your demo project and it returns BOT LISTENING in the terminal but it does not react to a /ping message. I also tested to send a message with
bot.send('CHAT_ID', 'Bot started...')
But no response on Telegram. I also checked the Wifi connection with sta_if.ifconfig() and looks good, so no connection problems. I get the following error on the first start of the code:
File "main.py", line 5, in <module>
File "utelegram.py", line 4, in <module>
File "urequests.py", line 181, in <module>
KeyboardInterrupt:
I have seen in your utelegram.py you are using the urequests and I suppose it has to do with following error from the urequests together with the telegram API. This error can be replicated with following code:
import urequests
def do_connect():
import network
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
if not wlan.isconnected():
print('connecting to network...')
wlan.connect('SSID', 'WIFI_PASSWORD')
while not wlan.isconnected():
pass
print('network config:', wlan.ifconfig())
do_connect()
msg = "Testmessage"
token = "XXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
user_id = "XXXXXXXXXX"
urequests.get(f'https://api.telegram.org/bot{token}/sendMessage?text={msg}&chat_id={user_id}')
And returns following error:
Traceback (most recent call last):
File "main.py", line 20, in <module>
File "urequests.py", line 162, in get
File "urequests.py", line 104, in request
OSError: -40
MicroPython v1.13 on 2020-09-11; ESP module with ESP8266
I have tried to find a solution but I have no clue....
Unfortunately I have no ESP32 on hand to try your code so I suppose this urequests error is only appearing on ESP8622 with the Telegram API, because using urequests.get("https://www.google.com") gets a valid reply...
Maybe this helps with solving the error. Cheers:)
Hi, With the latest merge we are explicitly freeing the urequests objects once they are no longer needed. I believe this could have been your issue. Could you please give it a try?
OSError: -40 on ESP 8266 (ESP01). very strange to work on esp32 and not on esp8266
OSError: -40 on ESP 8266 (ESP01). very strange to work on esp32 and not on esp8266
This might be related to a ESP8266 specific TLS problem other urequests users (like me) encounter
https://github.com/micropython/micropython/issues/3198#issuecomment-313856270 https://github.com/micropython/micropython-lib/issues/400#issuecomment-843416279