简体   繁体   中英

Using iotagent-node-lib

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM