Adding an array data source?


#1

Hello,

I am looking to transmit an integer array from my connected launchpad to the portal, however when I’m adding a data source to my portal the only available formats are integer, float and string. Does that mean I cannot send data of my integer array to the portal? Is there a way around if that’s the case?

Thanks for the time.


#2

Hi @Khan,

You are correct, a data source can only store either an integer, float or string. This means, as a work-around, you could store a collection by converting it to a string beforehand. I have seen other engineers use this to store very small files, text, JSON blobs, and arrays in a datasource. Commonly this data is then parsed or processed inside of a script in our platform.

If you are unfamiliar with scripting in our platform, you can learn more here: http://docs.exosite.com/scripting/

Let me know if you have questions about this,
-Martin


#3

Hi Martin,

I am needing to send multiple sensor readings from 4 different sensors (CO2, CH4, Temp, Humidity) to four different dataports. Right now I have a json format string being sent to one dataport then a script that parses the data and sends each value to its individual dataport.

The problem is I can only send 1 sample from each sensor. How do I arrange for multiple values to be sent to the same dataport from one json string? i.e I have 20 sample for each sensor, so a json string with 80 values. Right now I can handle parsing the data if each sensor only has one sample but I can’t figure out how to send multiple values to one dataport.

I am not set on going this route, if there is another way to send multiple points to a single dataport please let me know!

Best,

Gabriel


#4

The Device APIs for One Platform can be found here in the following links. I apologize as I think some of the legacy One Platform / Portals links are getting buried. It’s good for us to review this.

http://docs.exosite.com/portals/http/ - One Platform HTTP API

http://docs.exosite.com/portals/rpc/ - One Platform RPC API

This page (http://docs.exosite.com/portals) has links to the One Platform documentation, but when you go to any other link, it removes the proper side nav, we’ll have to change that.

Both have ways to send data to multiple individual resources (temperature, humidity, etc) and both have ways to send ‘recorded’ data with timestamps.

If you are sending your own formatted string and parsing, you could just add timestamps to this and update your lua script, but that is getting to be a lot of work when the API allows for timestamps.

http://docs.exosite.com/portals/rpc/#record
http://docs.exosite.com/portals/rpc/#recordbatch

http://docs.exosite.com/portals/http/#record

Just fyi - recorded data is not processed through datarules (events) the same way as regularly sent data is. If you need to run rules / notifications, you may need to do this in the lua scripting.

Cheers
-Mike