I am doing the integration through webhooks, but if the data appears in the particle console but then I get the 405 error and it does not send the data to firebase.
Have you checked all your data is there in the event?
HTTP 405 means “Method not allowed” so it is essential to also disclose the webhook definition and double check with Firebase which methods they do allow.
BTW, this code looks very familiar as some code I provided to someone a day ago but never heard back from them after that.
I do not know what your 405 issue is.
However I wanted to mention that Particle has a handy integration with Google Cloud (and hence can be used with Firebase) and you can find the documentation here:
It is the same code that you provided us, first we try to send each data in a particle.publish () but we feel like errors and we implement this one but I think the problem is that we are leaving the default json that comes in the weebhooks integration, you know How would we have to modify it to make it valid? Thanks in advance
If you want to push to Firebase you want to wrap your data into a JSON string.
You can use my code to do that by simply adapting the format string to conform to JSON and then in the webhook you can either pass that directly or “re-code” it into the format your Firebase endpoint expects it.
Hi, I already managed to send the data to the database but I have a problem with the pressure, it does not show me anything if I put it% .1f,% .2f,% .3f, etc. only if I put it as% d but I gives two values or 1202399705 or -187242071, I am using sparkfun’s mpl3115a2 sensor, do you have any idea why this happens? Thanks in advance
Example result: unixTime: 1602302723, wind_metersph: 0.0 mh, rain: 0.000 mm, windDegrees: 270 °, air: 293.8 K, humid: 36%, baro: 0.0 hPa, milli: 3876 mV
There is no space allowed between % and .1f - you must use %f, %.#f (where # stands for the number of decimal places) when you are dealing with floating point datatypes (of which barometerhPa is when you look at the definition of the struct).
You cannot use %d (placeholder for integer types) when you pass in a floating point - the two are fundamentally different in their respective binary encoding.
Also make sure your sensorReadings.barometerhPa is in deed a valid number (e.g. via Serial.println(sensorReadings.barometerhPa). If that also returns 0.0 you may not have read the pressure sensor before using the value.