-
Notifications
You must be signed in to change notification settings - Fork 7
Suripu Service
At the moment, Suripu service accepts two endpoints for data upload from a Morpheus device:
- POST /in/morpheus/pb
- POST /in/morpheus
- POST /audio/{mac_address}
This expects a periodic_data
message with the following definition:
message periodic_data {
optional int32 unix_time=1;
optional int32 light=2;
optional int32 temperature=3;
optional int32 humidity=4;
optional int32 dust=5;
optional string name=6;
}
Note: to see the most recent version check out the committed file
Note: In the future the message might be renamed to PeriodicData
to follow naming conventions
The server REQUIRES the content type to be set to: application/x-protobuf
. If you receive a HTTP 415
response, it means you are not sending the proper content-type.
You can expect a HTTP 204
if everything goes well.
Expects a csv with the following format:
snprintf( datastr, sizeof(datastr),
"%d,%d,%d,%d,%d,%d,%s",
MSG_VER,
data->time,
data->light,
data->temp,
data->humid,
data->dust,
MORPH_NAME
);
You can expect a HTTP 204
if everything goes well.
Anything in the body will be save in S3. The temporary naming scheme is "{mac_address}_{now()} ex: 123456789_2014-08-27T18:54:59.167Z
Our physical device – Morpheus – is connected to wifi and will upload directly to our receive endpoint
the data it has collected.
To verify that the data collected has been generated by our device we need to sign it. The setup is relatively simple:
-
At the factory or fulfillment center, a public-private key pair is generated. The private key is stored somewhat securely on the device and the public key is sent somewhat securely to our server and stored permanently in a database
-
When the data is ready to be uploaded to our servers, the firmware signs the payload with the private key and uploads it
-
The server extracts the device_id from the payload and fetches its associated public key. It then verifies the signature to validates the identity of the device and the veracity of the information uploaded.
-
That's it.
-
If the private key on the device is accessed, the data being sent may no longer have been generated by the device. This could impact our data collection processes and algorithms, especially for aggregates. The risk is low but still needs to be considered.
-
If the public key stored on the server is lost/corrupted, we will be unable to validate the data being sent. Regular backups are essential.