Parse Platform
Integrate Thingsee IoT data with Parse Platform (open-source Firebase alternative)
Parse Platform is an open-source application stack that provides an alternative to Google Firebase. Parse can be self-hosted or used as a managed service.
Overview
%%{init: {'theme':'base','themeVariables':{'primaryColor':'#73F9C1','primaryTextColor':'#143633','primaryBorderColor':'#143633','lineColor':'#143633','secondaryColor':'#C7FDE6','tertiaryColor':'#F6FAFA','clusterBkg':'#F6FAFA','clusterBorder':'#143633'}}}%%
flowchart TB
subgraph ParseServer["Parse Server"]
DB[(MongoDB)]
APP[Your Application]
DASH[Parse Dashboard]
P[Parse Server]
end
T[Thingsee Cloud]
T -->|REST API| P
P --> DB & APP & DASHDeployment Options
| Option | Description |
|---|---|
| Self-hosted | Docker, Kubernetes, VPS |
| Managed | Parse hosting providers |
| On-premises | Enterprise deployment |
Integration Methods
Method 1: Direct Document Creation
Send each Thingsee message as a Parse document:
curl --location --request POST 'https://your-domain.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"
}'
This creates separate Parse classes for each Thingsee Message type (tsmId).
Method 2: Bundle Processing with Cloud Functions
More efficient approach using Parse Cloud Functions:
curl --location --request POST 'https://your-domain.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
Deploy this Cloud Function to handle Thingsee messages:
// cloud/main.js
Parse.Cloud.define("upload-tsm", async (request) => {
const messages = request.params.data;
const results = [];
for (const message of messages) {
// Validate required fields
if (!message.tsmTs || !message.tsmTuid || !message.tsmId) {
console.log('Skipping invalid message:', message);
continue;
}
// Create class for this message type
const TsmClass = Parse.Object.extend("tsm_" + message.tsmId);
const tsm = new TsmClass();
// Set all properties
for (const prop in message) {
tsm.set(prop, message[prop]);
}
try {
const saved = await tsm.save();
results.push({ id: saved.id, tsmId: message.tsmId });
} catch (error) {
console.error('Failed to save message:', error.message);
}
}
return { done: true, saved: results.length };
});
Setup Steps
1. Deploy Parse Server
Using Docker:
docker run -d \
-e PARSE_SERVER_APPLICATION_ID=YOUR_APP_ID \
-e PARSE_SERVER_MASTER_KEY=YOUR_MASTER_KEY \
-e PARSE_SERVER_DATABASE_URI=mongodb://mongo/parse \
-p 1337:1337 \
parseplatform/parse-server
2. Deploy Cloud Functions
Copy the Cloud Function code to your Parse deployment.
3. Configure Integration
Contact Haltian with:
- Parse REST API URL
- Application ID
- Any authentication requirements
Parse Dashboard
Parse Dashboard provides quick access to your IoT data:
- Browse stored messages
- Query by device (tsmTuid)
- Filter by message type (tsmId)
- Export data
Data Organization
Data is organized into classes by message type:
| Parse Class | Thingsee Messages |
|---|---|
tsm_12100 | Environment (temp, humidity) |
tsm_13100 | Presence |
tsm_1110 | Battery status |
tsm_17100 | Distance |
Querying Data
JavaScript SDK
const Parse = require('parse/node');
Parse.initialize("APPLICATION_ID");
Parse.serverURL = 'https://your-domain.tld/parse';
// Query temperature data for a device
const TsmEnvironment = Parse.Object.extend("tsm_12100");
const query = new Parse.Query(TsmEnvironment);
query.equalTo("tsmTuid", "TSPR04E2O90201558");
query.descending("tsmTs");
query.limit(100);
const results = await query.find();
results.forEach(obj => {
console.log(`${obj.get('temp')}°C at ${obj.get('tsmTs')}`);
});
REST API
curl -X GET \
-H "X-Parse-Application-Id: APPLICATION_ID" \
'https://your-domain.tld/parse/classes/tsm_12100?where={"tsmTuid":"TSPR04E2O90201558"}&order=-tsmTs&limit=10'
Benefits
| Benefit | Description |
|---|---|
| Open source | No vendor lock-in |
| Self-hosted | Full data control |
| Scalable | MongoDB backend |
| SDKs | iOS, Android, JavaScript, etc. |
| Real-time | Live queries supported |