Parse platform is an open-source application stack alternative to Google Firebase. Parse has similar features as the Google Firebase, but a deployment and usage is free (well, you need to pay for the hosting anyway). Parse can be self-hosted on-premises (e.g. Docker) or as a hosted service.
Integrate IoT data just like any Parse document
Thingsee Cloud can send messages by using Parse REST API. This can be as simple as creating a Parse installation, opening the rest API and allowing us to push data using the APPLICATION_ID (from Parse). Note, that the example below creates new Parse classes for each Thingsee Message type (tsm), and every message is send separately.
curl --location --request POST 'https://yourdomain.tld/parse/classes/tsmId_12100' \
--header 'X-Parse-Application-Id: APPLICATION_ID' \
--header 'Content-Type: application/json' \
--data-raw '
{
"tsmId": 12100,
"tsmEv": 10,
"airp": 101364.599,
"lght": 6,
"temp": 21.3,
"humd": 21.7,
"tsmTs": 1520416221,
"tsmTuid": "XXXX03X2Z80562557",
"tsmGw": "XXXX00EFS80560445"
}
Send IoT data as bundles
The other option is to send Thingsee message bundles and have Parse processing the bundle using Parse’s Cloud Functions. This is a more efficient approach as it allows the same HTTP request to send multiple messages; and it follows the same cloud-function methodology as Google Firebase.
curl --location --request POST 'https://yourdomain.tld/parse/functions/upload-tsm' \
--header 'X-Parse-Application-Id: APPLICATION_ID' \
--header 'Content-Type: application/json' \
--data-raw '{
"data" : [{
"tsmId": 1110,
"tsmEv": 10,
"batl": 100,
"tsmTs": 1520416221,
"tsmTuid": "XXXX03X2Z80562557",
"tsmGw": "XXXX00EFS80560445"
},
{
"tsmId": 12100,
"tsmEv": 10,
"airp": 101364.599,
"lght": 6,
"temp": 21.3,
"humd": 21.7,
"tsmTs": 1520416221,
"tsmTuid": "XXXX03X2Z80562557",
"tsmGw": "XXXX00EFS80560445"
}]
}'
Parse Cloud function for handling Thingsee IoT messages
// Just an example. Not yet battle-tested in production environments.
Parse.Cloud.define("upload-tsm", async (request) => {
request.params.data.forEach(message => {
if (message.tsmTs && message.tsmTuid && message.tsmId) {
var TsmClass = Parse.Object.extend("tsm_"+message.tsmId);
var tsm = new TsmClass();
for (var propt in message) {
tsm.set(propt, message[propt]);
}
tsm.save()
.then((tsm) => {
}, (error) => {
console.log('Failed to create new object, with error code: ' + error.message);
});
}
});
return '{"done" : true}';
});
Parse Dashboard
Parse Dashboard gives you a quick view to your IoT data storage