Device API

Apikey authentication

If you want to call any of the following actions when your not logged in you have this options to authenticate with the API key:

Read only:

Read & Write:

Devicekey authentication

Using a device key will only allow sending data for the Node of that device, giving a greater level of security.

The input module can use a devicekey instead of an apikey. If you want to authenticate as a device, just replace apikey=APIKEY with devicekey=DEVICEKEY:

Ensure that the sent input Node matches the Node that is configured for the device on the device menu.

Available HTML URLs

The device list viewhttps://emoncms.org/device/view
This pagehttps://emoncms.org/device/api

Available JSON commands

To use the json api the request url needs to include .json

Device actions

List deviceshttps://emoncms.org/device/list.json
Get device detailshttps://emoncms.org/device/get.json?id=1
Add a devicehttps://emoncms.org/device/set.json?nodeid=Room&name=Test&description=House&type=test&dkey=DEVICEKEY
Delete devicehttps://emoncms.org/device/delete.json?id=1
Update devicehttps://emoncms.org/device/set.json?id=1&nodeid=Room&name=Test&description=House&type=test&dkey=DEVICEKEY
Generate a random device keyhttps://emoncms.org/device/generatekey.json
Set a new random device keyhttps://emoncms.org/device/setNewDeviceKey.json?id=1
Initialize devicehttps://emoncms.org/device/init.json?id=1

Device MQTT authentication

Request authenticationhttps://emoncms.org/device/auth/request.json
Check authentication requesthttps://emoncms.org/device/auth/check.json
Allow authentication requesthttps://emoncms.org/device/auth/allow.json?ip=127.0.0.1

Template actions

List template metadatahttps://emoncms.org/device/template/listshort.json
List templateshttps://emoncms.org/device/template/list.json
Reload templateshttps://emoncms.org/device/template/reload.json
Get template detailshttps://emoncms.org/device/template/get.json?type=example
Prepare device initializationhttps://emoncms.org/device/template/prepare.json?id=1

Devices templates documentation

Template files are located at '\Modules\device\data\*.json'

Each file defines a device type and provides the default inputs and feeds configurations for that device.

A device should only need to be initialized once on instalation. Initiating a device twice will duplicate its default inputs and feeds.