Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

FIWARE Global Summit - Building Your Own IoT Agent

88 views

Published on

Presentation by Daniel Calvo
IoE Lab. ATOS Research & Innovation

FIWARE Global Summit
8-9 May, 2018
Porto, Portugal

Published in: Technology
  • Be the first to comment

  • Be the first to like this

FIWARE Global Summit - Building Your Own IoT Agent

  1. 1. FIWARE Building your own IoT Agent Daniel Calvo IoE Lab. ATOS Research & Innovation daniel.calvo@atos.net @danicalvoalonso
  2. 2. Building your own IoT Agent: overview § Frameworks: Node.js and C++ • https://github.com/Fiware/iot.IoTagent-node-lib • https://github.com/telefonicaid/fiware-IoTAgent-Cplusplus § North bound features provided by the platform: • NGSI Context Provision server • NGSI Client • Device Provisioning API • Configuration API § All South bound features are protocol specific • External library • Ad-hoc development 1
  3. 3. Building your own IoT Agent: Node.js § Module provided in NPM Registry: • Add iotagent-node-lib to your package.json • Require it as any other module § https://github.com/telefonicaid/iotagent-node-lib/blob/master/doc/howto.md § Possible in few days/weeks: • Current agents: ~ 1000 lines of source code (supporting several transport protocols) 2 Context Server NGSI Client Device Protocol Device Registry Group Registry Provision Server IoT Agent
  4. 4. Building your own IoT Agent: CoAP + JSON 3 § CoAP: Constrained Application Protocol • RESTful protocol designed from scratch • Transparent mapping to HTTP • Binary protocol □ Low parsing complexity □ Small message size • Security based on DTLS (TLS/SSL for Datagrams) • IETF Standard: https://tools.ietf.org/search/rfc7252 GET /status/power PUT /control/color #00FF00
  5. 5. Building your own IoT Agent: CoAP + JSON 4 APPLICATION TRANSPORT SIMPLIFIED OSI NETWORK LINK PHYSICAL CoAP UDP IoT Device JSON IoT Agent UDP IPv4 TCP CoAP JSON HTTP NGSI/REST TCP CONTEXT BROKER IPv4 HTTP NGSI /REST § Protocol translation
  6. 6. Building your own IoT Agent: CoAP + JSON § Active attributes reporting • POST coap://{iot_agent_ip}/iot/coap { “deviceId": " #00FF00", “apiKey": “123456", “Luminosity”:”20”, “ActivePower”:”0.42” } § Southbound API: Rely on well-know libraries • coap package: https://www.npmjs.com/package/coap • coap-cli package: https://www.npmjs.com/package/coap-cli 5
  7. 7. Building your own IoT Agent: CoAP + JSON 1. Create a new node project • npm init 2. Add iotagent-node-lib dependency • npm install --save https://github.com/Fiware/iot.IoTagent-node-lib 3. Add your Southbound library • npm install –save coap 4. Add some usefull packages: • npm install –save async • npm install –save logops • npm install coap-cli -g 6
  8. 8. Building your own IoT Agent: CoAP + JSON § Start agent 7
  9. 9. Building your own IoT Agent: CoAP + JSON § Start south bound API: 8
  10. 10. Building your own IoT Agent: CoAP + JSON § Handle South Bound API requests: 9
  11. 11. Building your own IoT Agent: CoAP + JSON § Update attributes in IoT Agent and CB: 10
  12. 12. Building your own IoT Agent: CoAP + JSON § From JSON to NGSI: 11
  13. 13. Building your own IoT Agent: CoAP + JSON § Starting is quite easy and fast § IoT Agent supporting active attributes with CoAP and JSON data model • 1 single file • 147 lines of code • Less than two hours of coding • https://github.com/dcalvoalonso/iot.IoTagent-CoAP • https://hub.docker.com/r/danielcalvo/iotagent-coap/ 12
  14. 14. Thank you! http://fiware.org Follow @FIWARE on Twitter Daniel Calvo IoE Lab. ATOS Research & Innovation daniel.calvo@atos.net

×