Device module - Autoconfigured devices

Silently delivered with v9.2 there is a new Device module.

Device module allows to create template json files for each device type that will automatically configure a new node per device with a set of inputs, feeds and associated processlists.

Also added security is possible so a device can post with the new devicekey instead of apikey, just replace apikey=... with devicekey=... on the url that your device uses.
The devicekey used must be valid and the node that the device uses must match what is configured on the device menu for that key.
A devicekey is only valid for the device it was created.

To get new device templates for your device, you need to create a new json file, the first step is to name inputs and feeds like below, then build the processList that will link feeds to inputs, see the demo files at Modules\device\data.

There is an example.json template. I color coded the names that must be the same.
The process key (that has values 1 and 29 here), represent the processes of the processlist on emoncms, the number can be seen on the source code as the first number on the list of processes, see: https://github.com/chaveiro/emoncms/blob/master/Modules/process/process_...
The ProcessArg type is also the same value that is on this list for the same process key.
Blue lines are my comments.
It's a bit cryptic but easy to follow when you got it. Any doubts, just ask.

chris1howell's picture

Re: Device module - Autoconfigured devices

I have been using the device module to automatically setup feeds and inputs and device key to post input data.

Is there a way to use the device key to read input or feed data for the node associated with the device key?

It would be very useful if one could post a URL http://emoncms.org/emoncms/input/list.json?devicekey=123456789099875431 and get a response with all the inputs for the node/devicekey. THe current responce is "Unauthorized. Device key authentication only permits input post or bulk actions"

chaveiro's picture

Re: Device module - Autoconfigured devices

Hi chris1howell,

Sorry it's not supported, maybe to be added in future.

Can you share what is your use case for that ?

chris1howell's picture

Re: Device module - Autoconfigured devices

The use case is...

OpenEVSE is an Electric Vehicle Charging Station with an ESP8266 WiFi module which currently uploads power and temperature data to an EmonCMS server .

I would like to develop an smartphone app that can read the power and temperature data plus write command(s) to an input for the charging station to read and execute the next time it sends data.

It is possible to read back the data using the global API key, however it is very helpful to use the Device Auto configuration to configure inputs and feeds. Also it would be more secure to use the device key to both read and write to the inputs/feeds that are associated with the key especially since the ESP8266 Arduino code does not use HTTPS just yet.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.