Connecting a Device Running on Embedded Linux to Exosite using Node.js


Hi @inderectTV,

First off, It looks like you don’t have a timezone stored in your meta field. You can make an info call to your client to confirm this.

exo info <clientCIK> --pretty

Here’s an example of how to update your meta field:

echo '{"meta": "{\"timezone\":\"America\\/Chicago\"}"}' | exo update PARENT_CIK CHILD_CID -

Note: Make sure you don’t forget the - at the end.

As for your second question, I’m not sure what you mean when you say that the data shows up directly on the database as a value of 1. Can you explain exactly what you mean by that?

As for your error in Edit 2, when you use json.decode in line 17, is the value stored in packetval just your data set string with values separated by spaces? If this is the case, json.decode won’t work since it isn’t receiving valid json code and will just return nil.

-Joey Link


@joeylink and @Martin,

This is the current problem that I have so far:

Here is my code to send out the data to Exosite:

I know that the payload (which is a json table in string format) is being sent out to and received by Exosite (see below). My payload, in one example is ‘{“SGD1”:9,“SGD1”:9,…}’.

I tried decoding the JSON table into a lua table and sending it to my data source (show below). I have an error there, however.

This is what happens at my datasource; I keep getting a value of 1 (even though many of the data values that I send is 9).

So far, I can only think of a couple possibilities of why the data source is receiving a value of 1 only. Is the data bypassing the script and going directly to the data source? Is my JSON table (currently in a string) not properly formatted? Is there something that I am missing?




Hi Thomas, I see a few problems here and I think I’ve figured out why your data source is receiving 1’s. Let’s start with some of the problems I see in your code:

  1. You try to use a data port variable called “packet” which hasn’t been defined and is not connected to any defined data source alias. This will return a nil value.

  2. you have a space in your alias name for SGD1 in line 1. Your actual data port alias name does not have this space. This also results in returning a nil value.

  3. json.parse is not a supported command. You just need to use json.decode

  4. It looks like all of the keys in your table are identical, so you will be unable to reference any specific data point through its key value

The result of these bugs is that you end up writing a nil value to your dataport, which portals automatically reinterprets as 1.

I would reccomend that you read up on creating lua scripts on our docs page at

Also, here’s a link to the Lua 5.2 reference manual:

Hope this helps,