Overview


This documentation will try to cover different aspects of the Spotflock IoT platform in terms of software integration, cloud console, server APIs, and server deployment.


Beginner's Guide


Connect, Monitor and Analyze your device on cloud. One can connect multiple devices and use built-in dashboard to monitor different devices at once. Multiple widgets to create custom dashboard. Define rules to monitor conditions and trigger alerts. The internet of things (IoT) is the network of physical devices, vehicles, buildings and other items embedded with electronics, software, sensors, and network connectivity that enables these objects to collect and exchange data.The Internet of things refers to the devices like sensors and actuators etc. The devices e.g sensors will send data. This data will then be processed and used by people or by machines to control the devices or other devices.

For example: A temperature sensor sends temperature data to a process which determines that the room temperature is too hot and so sends a signal to turn on the air conditioning. The IOT will affect many areas of day to day life. Some of the main sectors are: Home, Health medical, Fitness and wellness, factory and industry, Agriculture, Cars and roads, Cities,

IOT Components

The things -sensors actuators :These actually senses the data required,analyses the data.

The Network : Interconnectivity between a thing and plaform.

The Platforms,Apps and services : User Interface which helps users to get notified or updated regarding the thing.


Quickstart


Following : 3 services are provided by Phoenix ML as part of Release 1.2.0.

  • Devices : Registering the device to platform for connecting it to IoT console.

  • Dashboards : Dashboards which are used as containers which have widgets.

  • Widgets : Actual visualization of data can be seen here.


APIs


All URIs below are relative to https://studio.spotflock.com

Add a Device POST  /api/v1/iot-service/cloud-iot/device
Get Device GET  /api/v1/iot-service/cloud-iot/device/{id}
Add a Dashboard POST  /api/v1/iot-service/cloud-iot/dashboard
Get Dashboard GET  /api/v1/iot-service/cloud-iot/dashboard/{id}
Add Widget POST  /api/v1/iot-service/cloud-iot/widget
Get Widget Data POST/api/v1/iot-service/cloud-iot/widget/data

Add a Device

Description

This API would enable you to configure device and its event Interval of data transmission.

URI

POST  /api/v1/iot-service/cloud-iot/device

Headers

api-key Your App's API Key

Attributes

name Lenovo thinkpad
descriptions sending temperature data
eventInterval 5s or 1m or 2h or 3d.Interval of time at which device is sending data.m-minutes,h-hours,s-seconds,d-days

Request Example

{
	"name":"Lenovo thinkpad",
	"description":"sending temperature data",
	"eventInterval":"1m"
}

Response

{deviceId}

Get Device

Description

This API would enable you to get Device Info that is already configured.

URI

POST  /api/v1/iot-service/cloud-iot/device/{deviceId}

Headers

api-key Your App's API Key

Request Example

Response


{
"device":{
            "id":1,
            "name":Lenovo Thinkpad,
            "description":"sending temperature data",
            "eventInterval":"1m"
                                    }
"isConnected":false,
"lastConnection":"2017-10-14T22:11:20+0000",
"ipAddress":"14.67.324.322",
"hasWidgetConfig":true
}

Add a Dashboard

Description

This API would enable you to add Dashboard which can contain many widgets.

URI

POST  /api/v1/iot-service/cloud-iot/dashboard

Headers

api-key Your App's API Key

Attributes

name Lenovo thinkpad
descriptions sending temperature data

Request Example

{
	"name":"Lenovo thinkpad dashboard",
	"description":"sending temperature data"
}

Response

{dashboardId}

Get Dashboard

Description

This API would enable you to get Dashboard details you already configured.

URI

POST  /api/v1/iot-service/cloud-iot/dashboard/{dashboardId}

Headers

api-key Your App's API Key

Request Example


Response

{
    "id":1,
	"name":"Lenovo thinkpad dashboard",
	"description":"sending temperature data"
}

Add a Widget

Description

This API enables you to create a widget for visualizing data.

URI

POST  /api/v1/iot-service/cloud-iot/widget

Headers

name Text Widget
descriptions get temperature data
type TEXT or TIMESERIESGRAPH
resource Temperature(you need to add this same resource in your device code.)
device.id {deviceId}
dashboard.id {dashboardId}

Request Example


                                    {

		"name":"Text Widget",
		"description":"get temperature data",
		"type":"TEXT",
		"resource":"Temperature",
		"device":
		{
			"id":1
		},
		"dashboard":
		{
			"id":1
		}
	}

Response


	{
    "id": 1,
    "name":"Text Widget",
    "description":"get temperature data",
    "type":"TEXT",
    "resource":"Temperature",
    "dashboard": {
        "id": 1,
        "userId": 1,
        "name":"Lenovo thinkpad dashboard",
	    "description":"sending temperature data"
        "appId": 1
    },
    "device": {
        "id": 1,
        "userId": 1,
        "name":Lenovo Thinkpad,
        "description":"sending temperature data",
        "eventInterval":"1m"
        "appId": 1,
    }
}

Add a Widget

Description

This API enables you to send device data to widget for visualizing data.

URI

POST  /api/v1/iot-service/cloud-iot/widget/data

Headers

widget.id {widgetId}
widget.name Timeseries Widget
widget.description get temperature data
widget.type TIMESERIESGRAPH or TEXT
widget.resource Temperature
widget.dashboard.id {dashboardId}
widget.dashboard.userId {userId}
widget.dashboard.name Lenovo thinkpad dashboard
widget.dashboard.description sending temperature data
widget.dashboard.appId {appId}
widget.device.id {deviceId}
widget.device.userId {userId}
widget.device.name Lenovo thinkpad
widget.device.description sending temperature data
widget.device.appId {appId}
widget.device.eventInterval 1m
widget.timePeriod 1d(should give none for TEXT widget)

Request Example


                                    {
"widget":{
        "id": 1,
        "name":"Timeseries Widget",
        "description":"get temperature data",
        "type":"TIMESERIESGRAPH",
        "resource":"Temperature",
        "dashboard": {
            "id": 1,
            "userId": 1,
            "name":"Lenovo thinkpad dashboard",
            "description":"sending temperature data"
            "appId": 1
        },
        "device": {
            "id": 1,
            "userId": 1,
            "name":Lenovo Thinkpad,
            "description":"sending temperature data",
            "eventInterval":"1m"
            "appId": 1,
        }
    },
"timePeriod":"1d"
}

Response


	[
    {
        "timestamp": "2019-05-28T05:00:01.611Z",
        "deviceId": "1",
        "resource": "Temperature",
        "resourceValue": 90,
        "ipAddress": "14.98.161.70",
        "latitude": "17.7371",
        "longitude": "79.1345"
    },
    {
        "timestamp": "2019-05-28T05:01:07.18Z",
        "deviceId": "1",
        "resource": "Temperature",
        "resourceValue": 80,
        "ipAddress": "14.98.161.70",
        "latitude": "17.7371",
        "longitude": "79.1345"
    },
    {
        "timestamp": "2019-05-28T05:11:03Z",
        "deviceId": "1",
        "resource": "Temperature",
        "resourceValue": 85,
        "ipAddress": "14.98.161.70",
        "latitude": "17.7371",
        "longitude": "79.1345"
    },
    {
        "timestamp": "2019-05-28T05:12:50.066Z",
        "deviceId": "1",
        "resource": "Temperature",
        "resourceValue": 70,
        "ipAddress": "14.98.161.70",
        "latitude": "17.7371",
        "longitude": "79.1345"
    },
    {
        "timestamp": "2019-05-28T05:16:49.909Z",
        "deviceId": "1",
        "resource": "Temperature",
        "resourceValue": 105,
        "ipAddress": "14.98.161.70",
        "latitude": "17.7371",
        "longitude": "79.1345"
    },
    {
        "timestamp": "2019-05-28T05:23:23.604Z",
        "deviceId": "1",
        "resource": "Temperature",
        "resourceValue": 95,
        "ipAddress": "14.98.161.70",
        "latitude": "17.7371",
        "longitude": "79.1345"
    },
    {
        "timestamp": "2019-05-28T16:17:49.68Z",
        "deviceId": "1",
        "resource": "Temperature",
        "resourceValue": 88,
        "ipAddress": "14.98.161.70",
        "latitude": "17.7371",
        "longitude": "79.1345"
    },
    {
        "timestamp": "2019-05-28T16:19:22.68Z",
        "deviceId": "1",
        "resource": "Temperature",
        "resourceValue": 91,
        "ipAddress": "14.98.161.70",
        "latitude": "17.7371",
        "longitude": "79.1345"
    },
    {
        "timestamp": "2019-05-28T16:27:44.773Z",
        "deviceId": "1",
        "resource": "Temperature",
        "resourceValue": 60,
        "ipAddress": "14.98.161.70",
        "latitude": "17.7371",
        "longitude": "79.1345"
    },
    {
        "timestamp": "2019-05-28T16:30:18.891Z",
        "deviceId": "1",
        "resource": "Temperature",
        "resourceValue": 99,
        "ipAddress": "14.98.161.70",
        "latitude": "17.7371",
        "longitude": "79.1345"
    },
    {
        "timestamp": "2019-05-28T17:14:08.584Z",
        "deviceId": "1",
        "resource": "Temperature",
        "resourceValue": 100,
        "ipAddress": "14.98.161.70",
        "latitude": "17.7371",
        "longitude": "79.1345"
    },
    {
        "timestamp": "2019-05-28T17:15:38.633Z",
        "deviceId": "1",
        "resource": "Temperature",
        "resourceValue": 95,
        "ipAddress": "14.98.161.70",
        "latitude": "17.7371",
        "longitude": "79.1345"
    }
]


Release Notes


Folowing are the release notes as part of Release 1.2.0

  • Devices are sending data based on the interval they configured.But they need to deploy the piece of platform specific code we have exposed.

  • All of the devices will be sending their data through a mosquito MQTT broker.So,this is sort of a PubSub kind of model. mosquitto version 1.4.15 MQTT v3.1.1/v3.1 broker.

Helpdesk