Particle Notes field

the reference I have seen is from:

https://docs.particle.io/reference/device-cloud/api/#get-device-information

and it shows:

GET /v1/devices/0123456789abcdef01234567
HTTP/1.1 200 OK
{
"id": "0123456789abcdef01234567",
"name": "gongbot",
"variables": {
"Gongs": "int32"
},
"functions": [
"gong",
"goto"
],
"connected": true,
"platform_id": 6,
"product_id": 6,
"system_firmware_version": "0.7.0"
"cellular": false,
"serial_number": "AAAAAA111111111"
"last_ip_address": "176.83.211.237",
"last_heard": "2015-07-17T22:28:40.907Z",
"notes": null,
"firmware_updates_enabled": true,
"firmware_updates_forced": false
}

So I would assume that I access the notes field the same way I access the name field.

however, notice in the example that it ALSO shows "null" for the notes field.

I would really like to get the notes from the console.

I think the problem you could be seeing is that you are subscribing to topics and publishing the string before the webhook handler has had time to set the string.

I think you should try declaring all of your subscriptions early in setup(), and not publish any events until you have established a connection to the Particle cloud.

You need to give time for the webhook handlers to get the response from one webhook, save it to the string, and then publish the next event to call the next webhook. You could even have the handler for one webhook publish the event that triggers the next webhook.

I will check that out and get back to the forum when I have a chance to try it.

Thanks for the information!

I created a library and examples for using Device Notes from a Particle device. It uses a combination of a library and a webhook (or two).

There are two common uses for it:

  1. Storing configuration data on the cloud so all devices can have the same user firmware, and get their configuration from the cloud.

  2. Storing small amounts of data from the device in the Device Notes field. While Particle.publish and Particle.variable are a more common way to get data from a device, Device Notes is an interesting technique if you don’t have an server to receive publishes and especially if the device is mostly offline.

It also shows how to use JsonParserGeneratorRK to manage JSON data, including both parsing and updating JSON data in place. This allows you to store multiple structured data values in the Device Notes field.

8 Likes

Hi @rickkas7 I have tried the library for get Notes but just wondered if you could help answer a couple of questions:

  1. Can this approach be applied to any device that is a product.
  2. At startup - what is the limitation in the size of the data that can be passed to a device and can that be greater than 622 bytes. In your example you have set the buffer as 1024 bytes.
  3. If binary data is sent - assume that this needs to be encoded as base64 ascii.

The Put method seems to be a good way to save a device crash report to the console. Do you have any examples of other uses?