ckoever/micropython-firebase-realtime-database

ESP32: OSError: ECONNABORTED

Closed this issue · 3 comments

Problem with the library running it in an esp32 module. Simple code that captures data through the Inventor App that turns a led on and off. The application works wonderfully but after a while (40-60 seconds) the connection is terminated and the following error appears.

Traceback (most recent call last):
   File "<stdin>", line 21, in <module>
   File "ufirebase.py", line 124, in get
   File "urequests.py", line 116, in get
   File "urequests.py", line 60, in request
OSError: [Errno 113] ECONNABORTED

import ufirebase as firebase
import network
from machine import Pin
import gc
import time

gc.collect()
ssid = 'USSER'
password = 'PASSWORD'
station = network.WLAN(network.STA_IF)
station.active(True)
station.connect(ssid, password)

while station.isconnected() == False:
pass
print('CONECTADO')
print(station.ifconfig())
led = Pin(13, Pin.OUT)

while True:
led1 = firebase.get('https://esp32-led1-a3072-default-rtdb.firebaseio.com/ESP_LED/Condicion%20de%20LED')
print(led1)
if led1 == '1':
print('LED ON')
led.on()
if led1 == '0':
print('LED OFF')
led.off()
time.sleep(1)

Thanks!!

firebase.setURL("https://esp32-led1-a3072-default-rtdb.firebaseio.com/") #Set your Firebase URL before!
firebase.get("ESP_LED/Cond.....", led1, bg=False) #led1=your var; "ESP_LED/..."=your "path"/variable
led1=firebase.led1

https://github.com/ckoever/micropython-firebase-realtime-database/blob/main/example.py