Recall our structure of sending data from an asset, via the MQTT broker, to Assetwolf:
Assuming your device is connected using MQTT, it should publish its data to:
$sensorTopic = "up/client/clientId/asset/deviceId";
The topic is structured in this way:
up
means device to cloudclientID
is your client identifier)deviceId
the communication device identifier.The JSON payload should look like this (but you can remove newlines and spaces):
{
"timestamp": timestamp,
"field1": "boolean",
"field2": integer,
"field3: float,
"latitude": latitude,
"longitude": longitude,
"field4": "string",
"field5": "state_indicator"
}
You do not have to send all fields that are defined on the schema for this asset. It's quite normal to send partial data, or that the full set of field data is only sent occasionally.
Optional! You only need to send this if you want to be specific about the time that the current data refers to, or if you wish to send data for sensor readings taken in the past. Must be a Unix microtime (milliseconds since 1970).
Must be either "true"
or "false"
(with double quotes).
You can send integer and floating-point numbers, no quotes are necessary.
Be sure to use double-quotes (not single quotes) around all alphanumeric fields. Numeric fields can have quotes but they are optional.
If the asset has a state indicator, such as a run mode, you can send a state indicator, such as "1", or "on" for example. This can be used to display an icon within the portal (on a schematic floorplan, a list of assets, or on an asset's status panel).
On the Dashboard on your portal, and look at your assets. If all is well, you should see some data has arrived.
When editing the schema for the asset, you will notice a small "+" sign in the list of "Incoming data from asset". You can use this to specify an short alias.
Here for example a floating-point field is called "lightlevel
", but to the Superuser is adding a short alias "L
":
In the data transmission, the value of this field can now be sent with a reduced data size. Without the alias the format would be like this:
{
"lightlevel": 499
}
With the alias defined, data can now be sent like this:
{
"L": 499
}