Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (27 sloc) 1.73 KB
{
"name": "emnifyEndpointConnectivitySensor",
"version": "0.0.6",
"type": "sensor",
"script": "// EMnify Endpoint Connectivity Sensor\n\nif (options.requiredProperties.endpointId) {\n var baseUrl = 'https://cdn.emnify.net/api/v1/';\n var endpointId = options.requiredProperties.endpointId;\n var authToken = options.globalSettings.EMNIFY_AUTH_TOKEN;\n var options = {\n url: baseUrl + 'endpoint/' + endpointId + '/connectivity',\n headers: {\n 'Authorization': 'Bearer ' + authToken\n }\n };\n\n request(options, function (err, resp, body) {\n if (resp.statusCode == 200) {\n var data = JSON.parse(body);\n\n var value = {\n observedState: data.status.description,\n rawData: data\n };\n\n send(null, value);\n }\n else {\n send(new Error('Received unexpected statusCode=' + resp.statusCode + ' from EMnify API'));\n }\n });\n\n} else {\n send(new Error(\"Missing property endpointId\"));\n}\n",
"metadata": {
"author": "Martin Giess",
"category": "Network",
"description": "EMnify Endpoint Connectivity Sensor\n\nMonitors cellular connectivity of Endpoints fitted with EMnify SIM.\n\nExpects EMnify authentication token stored in global settings as EMNIFY_AUTH_TOKEN and endpointId as required property.\n\nhttp://www.emnify.com\n",
"iconURL": "https://static.waylay.io/plugs/icons/emnify.png",
"supportedStates": [
"ONLINE",
"ATTACHED",
"OFFLINE"
],
"requiredProperties": [
"endpointId"
],
"requiredRawData": [],
"rawData": [
{
"parameter": "location.country.name",
"dataType": "string"
}
]
}
}
You can’t perform that action at this time.