firebase-arduino
firebase-arduino copied to clipboard
add support for ESP32
using the official esp32 arduino core: https://github.com/espressif/arduino-esp32
are there any updates on that?
@Ahmed-Talaat I'm experimenting in that branch: https://github.com/proppy/firebase-arduino/tree/esp32
Got it to compile, but still have TLS issue when making the actual request.
Is there anything in particular that we can help with @proppy ?
@danielcrowley sure feel free to try out the branch, and let me know if you also get a TLS error ;)
I got an error.
src/FirebaseArduino.h:22:65: fatal error: third-party/ArduinoHttpClient/src/ArduinoHttpClient.h: No such file or directory
@bestpika yes, you need to checkout https://github.com/arduino-libraries/ArduinoHttpClient in the third-party directory.
@proppy I do it, but got another error (I use example FirebaseDemo_ESP8266 and change #include <WiFi.h>).
FirebaseDemo_ESP8266:43: error: 'Firebase' was not declared in this scope
Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
^
FirebaseDemo_ESP8266:50: error: 'Firebase' was not declared in this scope
Firebase.setFloat("number", 42.0);
^
'Firebase' was not declared in this scope
So I use WiFiClientSecure to direct send data to <...>.firebaseio.com...
@proppy My thing is the same Is there a way to fix it?
MacAddress:37: error: 'Firebase' was not declared in this scope
Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
^ C:\Users\Sivakorn\Documents\Arduino\MacAddress\MacAddress.ino: In function 'void loop()':
MacAddress:45: error: 'Firebase' was not declared in this scope
Firebase.setFloat("number", 42.0);
^ <
There is any update on this?
I've tried to install the branch proposed by @proppy with not luck. There is any way how I could help?
did anyone get the right solution? my error is: 'Firebase' was not declared in this scope
@proppy could you help us? Please.
That should be easier to implement now that they added an HTTPClient w/ SLL in the ESP32 arduino core that is supposed to match the API for the ESP8266: https://github.com/espressif/arduino-esp32/commits/master/libraries/HTTPClient
@proppy Could you commit this to your branch https://github.com/proppy/firebase-arduino/tree/esp32 We really need a Firebase access with ESP32 Arduino Thanls
I had to add extern FirebaseArduino Firebase; at the end of FirebaseArduino.h and there is a problem of EmbeRec:92: error: no matching function for call to 'FirebaseArduino::setString(const char [14], String&)' but it can be solved
but for
C:\Users\xxxx\Documents\Arduino\hardware\espressif\esp32\libraries\firebase-arduino-esp32\src\FirebaseArduino.cpp:36:66: error: no matching function for call to 'HttpClient::HttpClient()'
FirebaseArduino::FirebaseArduino(Client& client) : client_(client) {}
In file included from C:\Users\xxxx\Documents\Arduino\hardware\espressif\esp32\libraries\firebase-arduino-esp32\src\third-party/ArduinoHttpClient/src/ArduinoHttpClient.h:8:0, ..... C:\Users\xxx\Documents\Arduino\hardware\espressif\esp32\libraries\firebase-arduino-esp32\src\third-party/ArduinoHttpClient/src/HttpClient.h:53:5: note: candidate: HttpClient::HttpClient(Client&, const IPAddress&, uint16_t)
HttpClient(Client& aClient, const IPAddress& aServerAddress, uint16_t aServerPort = kHttpPort);
I don't know how to deal with it
@blotfi I think my branch was using a patched version of ArduinoHttpClient:
diff --git a/src/HttpClient.cpp b/src/HttpClient.cpp
index b46f628..4fb7694 100644
--- a/src/HttpClient.cpp
+++ b/src/HttpClient.cpp
@@ -28,6 +28,17 @@ HttpClient::HttpClient(Client& aClient, const IPAddress& aServerAddress, uint16_
resetState();
}
+void HttpClient::begin(Client& aClient, const char* aServerName, uint16_t aServerPort)
+{
+ iClient = &aClient;
+ iServerName = aServerName;
+ iServerAddress = IPAddress();
+ iServerPort = aServerPort;
+ iConnectionClose = true;
+ iSendDefaultRequestHeaders = true;
+ resetState();
+}
+
void HttpClient::resetState()
{
iState = eIdle;
diff --git a/src/HttpClient.h b/src/HttpClient.h
index e627b21..6cf21b6 100644
--- a/src/HttpClient.h
+++ b/src/HttpClient.h
@@ -46,10 +46,12 @@ public:
// FIXME Write longer API request, using port and user-agent, example
// FIXME Update tempToPachube example to calculate Content-Length correctly
+ HttpClient() {};
HttpClient(Client& aClient, const char* aServerName, uint16_t aServerPort = kHttpPort);
HttpClient(Client& aClient, const String& aServerName, uint16_t aServerPort = kHttpPort);
HttpClient(Client& aClient, const IPAddress& aServerAddress, uint16_t aServerPort = kHttpPort);
+ void begin(Client& aClient, const char* aServerName, uint16_t aServerPort = kHttpPort);
/** Start a more complex request.
Use this when you need to send additional headers in the request,
but you will also need to call endRequest() when you are finished.
@proppy where canI get it so ? or can you put all he stuf on ESP32 dev tree https://github.com/proppy/firebase-arduino/tree/esp32
@blotfi you need to make the same modification that I linked, but even after than there is still an SSL error we need to solve.
So it's not working yet.
@proppy Do you have time to solve the issues? I am in Electrical Engineering / Teacher, so not a really good programmer ;-) I can test of course to help you
@proppy Hi, do you plan to start again the https://github.com/proppy/firebase-arduino/tree/esp32 Thanks
@proppy Hi, is there any new dev for ESP32 ? thanks
Same question, any future support for ESP32? Thanks for all development, I would also be willing to help!
One good way to support the ESP32 would be to standardize on the ArduinoHttpClient or the arduino Client interface https://www.arduino.cc/en/Reference/ClientConstructor interface, instead using of using the HttpClient in the esp8266 core.
Tracking this here: #344.
@proppy any news regarding ESP32 support?
@Curclamas I'd welcome some more testing on https://github.com/FirebaseExtended/firebase-arduino/pull/353 if you want to give it a try.
Ola a todos! Utilisei o seguinte procedimento para logar ao firebase (ESP32 + FIREBASE): Segue um exemplo de contador:
#include <WiFi.h> #include <WiFiClientSecure.h>
const char* ssid = "xxxxxxxx"; // Sua rede WIFI const char* password = "xxxxxxxx"; //Senha do wifi
const char* host = "xxxxxxxxxx.firebaseio.com"; //Login firebase const char* firebase_auth = "xxxxxxxxx"; //Password firebase
String user_path = "usuario";// Usuario cadastrado no firebase database int count = 0;
WiFiClientSecure client;
//********************** void setup() { Serial.begin(115200);
WiFi.begin( ssid, password );
Serial.print( "connecting" ); while ( WiFi.status() != WL_CONNECTED ) { Serial.print("."); delay(500); } Serial.println(); Serial.print( "connected: " ); Serial.println( WiFi.localIP() );
delay(2000); } //********************** void loop() { sendPatchRequest( "text", String( count ) ); count++; if( count > 10 ) count = 0; } //******Firebase Realtime Database ************** void sendPatchRequest( String str1, String str2 ){ if( !client.connect( host, 443 ) ){ Serial.println( "Connection failed!" ); }else{ Serial.println( "Connected to server!" ); String req_url_str; req_url_str = "PATCH /"; req_url_str += user_path; req_url_str += ".json?auth="; req_url_str += String( firebase_auth ); req_url_str += " HTTP/1.1\r\n";
String body = "{\"" + str1 + "\":\"" + str2 + "\"}";
String head;
head = "Host: ";
head += String( host ) + "\r\n";
head += "Connection: keep-alive\r\n";
head += "Content-Length: ";
head += String( body.length() ) + "\r\n";
head += "\r\n";
client.print( req_url_str );
client.print( head );
client.print( body );
Serial.println( "####### Solicitação de PATCH HTTP #######" );
Serial.print( req_url_str );
Serial.print( head );
Serial.println( body );
checkServerRespons();
delay(2);
client.stop();
delay(2);
} } //*********************************** void checkServerRespons(){ //É importante receber todas as respostas do servidor do Firebase Serial.println("####### Firebase Server HTTP Resposta #######"); while( client.connected() ){ String resp_str = client.readStringUntil('\n'); //Ler a string Serial.println( resp_str ); if( resp_str == "\r" ) { //Linha em branco Serial.println("------------- Cabeçalho da Resposta"); break; } } //Após o retorno do cabeçalho de resposta, a parte do corpo volta while( client.available() ){ char c = client.read(); Serial.print( c ); } Serial.println("\r\n----------- Corpo Recebido"); }
Fonte: https://www.mgo-tec.com No fire base fica assim:
*****FIREBASE Nome_Banco_de_dados usuario text:"0"
Worked just fine! Thanks lucianoracing!
can you please translate instructions into english?