Timezone Offset Issue

Whenever my sensor data is retrieved by a webhook, the events will show up with a ‘‘published-at:’’ value that is for the UTC timezone. I read some topics and tried adding ‘‘Time.zone(-8);’’ in my code, but this didn’t seem to have any effect.

Is there any way to send out the correct information? Help is very much appreciated :slight_smile:

Hello,

Let me ping someone that might be able to help, @rickkas7 are you able to assist?

Kyle

The event is timestamped by the cloud on arrival and by that time the cloud has no knowledge about the zone you have set on your device.
This behaviour is common for global services.

If you want an event to carry your local time you need to send that info in your event (either as payload or part of the event name)

3 Likes

Oh I see, that makes sense! So I will have to look for a way to put the date in the output data somehow…thanks!

Also, I have an other tricky issue Im struggling to solve: Right now, I have several values in my output data that appear as one big comma-seperated string. When using the webhook (ThingSpeak) to store it and export to Excel, I’m not able to neatly organize it.

Example of how it currently is:
Field 1: Sensor1, 75.6,Pickup, 187

Example of how I would like it to be:
Field 1: Sensor1
Field 2: 75.6
Field 3: Pickup
Field 4: 187

Any way to not have all my data appear in one string?

You could use \n or \r\n instead of the comma to have the line breaks in the string.
But when you use webhooks you might consider using JSON format for key/value pairs.

Thanks, I’m reading Rickas’ tutorial right now (in case other readers would like to do the same as me: https://github.com/rickkas7/particle-webhooksabout) JSON and webhooks, I’m sure that will be of help with this.