Device Gateway Service

[DEPRECATED] Please use the Device2 service instead. API allowing communication with IoT devices.

Events

Events


datapoint

This event is triggered by data generated by devices and transmitted by the One Platform device API. More information about how to send data to the OneP API on http://docs.exosite.com/reference/products/device_api/http/#write

Arguments

data - object - The data from the device
Name Type Description
api "write", "record" Provider API
pid string Device Product ID
rid string Unique device resource ID
seq integer The message sequence number for specific resource ID
alias string Device resource alias
value [ integer
or number
or string ] {..2}
Data transmitted by the device.
If API == write, the first value is "live",
If API == record, the first value is the event timestamp as integer.
The second value is always the data transmitted, either number or string.
device_sn string Device serial number
source_ip string The device source IP
timestamp integer Server recording time for the event

Example

function handle_device_datapoint (data)

 -- Your logic comes here 

end