Particle Console to Google Cloud Firestore to Python


I’m trying to get temperature data from my Xenon into Python so I can plot it.
I’m publishing temperature data and can see it in the Particle Console.

So I set up a Google Cloud Platform Project and successfully added the integration between Particle & Google.

Here’s what I see in the Particle Console:

And here’s what I see in the Google Cloud Platform (Firestore):

On the RHS of the Firestore image you can see the “data” field, Hovering over this in Firestore tells me its a ‘blob’. Is this right? I thought I’d see my raw temperature data (float)?

I don’t know what I’m doing. I’ve read about blobs and I’m lost. My ultimate aim is to log temperature data “to the cloud” and be able to use Python to plot that over various time intervals, having the data backed up on the cloud.

At a guess the blanks in the hook-sent/Temperature field in the Particle Console is at the root of my problems. I had expected (with no idea if I’m right or not) to see my raw data in Firestore.

Any help would be much appreciated…

Thanks for your time,

1 Like

Hey RK79,

I was wondering how you connected your Xenon to Firestore? We are having problems figuring that out.

Thank you for the help.

@RK79 i’m betting you’ve figured out your issue by now but for posterity, the issue is that the Google PubSub lib provides event data as a buffer (docs) but you want to store it as a string.

it’s simply a matter of converting it - for example:

const obj = {
	device_id: message.attributes.device_id,
	event: message.attributes.event,
	published_at: message.attributes.published_at,
	data:'utf8'), // <-- now it's a string

and here’s what it looks like in Firestore:

you can see that the data field is stored as a string while data_raw is stored as a blob

sorry it took a bit to get you this info - hope it helps!