Using iotagent-node-lib

157 views Asked by At

I have receiving data from our sensors using GET. The request format is: http://IP:PORT/PATH?Operation=InsertObservation&value=0.0012&unit_id=123456&sensor_id=75648. How I can, using iotagent-node-lib, write them to Orion Context Broker?

1

There are 1 answers

0
Daniel Morán Jiménez On BEST ANSWER

The fast answer is: "using the iotagentLib.update() method". The slow and complete one imply some other steps you will need to complete to have a fully working agent. I suggest you take a look at the code of https://github.com/telefonicaid/sigfox-iotagent. That's one of the latest IOTAs we started to develop, and makes use of the IoT Agent Node Lib. Sigfox callbacks use HTTP calls much like your approach, so it should be really easy to modify the Sigfox Agent's code to feet your needs. Most of the interesting code is in this file:

https://github.com/telefonicaid/sigfox-iotagent/blob/develop/lib/sigfoxHandlers.js

I think you can reuse most of the code, excluding the sigfoxParser. If you have further doubts, you should be able to solve your doubts using iotagent-node-lib documentation.