Fiware Developers Week Iot exercises (Advanced)

10
IoT Exercises (IDAS GE) (Advanced– LWM2M IoT-Agent) Contact twitter @fermingalan Contact email [email protected] [email protected] [email protected]

Transcript of Fiware Developers Week Iot exercises (Advanced)

Page 1: Fiware Developers Week Iot exercises (Advanced)

IoT Exercises (IDAS GE)(Advanced– LWM2M IoT-Agent)

Contact twitter

@fermingalanContact email

[email protected]

[email protected]

[email protected]

Page 2: Fiware Developers Week Iot exercises (Advanced)

0. Deploy a Lightweight M2M IoT Agent

• Prerequisite– Node.js v0.10.x (installed interpreter)

• Steps– Install the IoT Agent from the following URL

https://github.com/telefonicaid/lightweightm2m-iotagent

• Hints– The agent is a standard Node.js application, following the

usual folder conventions (as /bin for the executables)

Easy

Page 3: Fiware Developers Week Iot exercises (Advanced)

1. Provision a Device using the Provisioning API

• Prerequisites– Any kind of REST Client (programmatic, command-line, browser plugin...)

• Steps– The goal of this exercise is to handle the device creation and management

with an IoT Agent. You will provision a device with the following properties:• name: ws1• entity name: weather1• type: weatherStation• attributes: two attributes, temperature and humidity, with float type.

– Do the following steps:• Provision the new device in the IoT Agent using the Device Provisioning API.• List the information about the provisioned device.• Remove the device from the IoT Agent

• Hints– You will find all the API operations in the following URL:

https://github.com/telefonicaid/iotagent-node-lib#-device-provisioning-api

Easy

Page 4: Fiware Developers Week Iot exercises (Advanced)

• Prerequisites– Node.js v0.10.x (installed interpreter)– Context Broker knowledge (queries)

• Steps– In this exercise you will install a LWM2M client to simulate the information

sending from the client. You can find the LWM2M client in the following URL

https://github.com/telefonicaid/lwm2m-node-lib

– Perform the following tasks :• Provision a device as the one you used in exercise 1 in the IoT Agent with id “ws2’

and name “weather2” with Temperature and Humidity sensors as defined in theOMA Registry (names should be “Temperature Sensor” and “Humidity Sensor”).

• Install the client project and execute the command line LWM2M Client.• In the client, create the temperature and humidity objects in the client and assign

them resource with ID 0.• Connect the device to the IoT Agent. The client should be assigned an ID by the

server.• Change the original values and check the information changes in the Context

Broker.

• Hints– the Object ID for the temperature sensor in the OMA Registry is 3303 and

for the humidity sensor 3304.

Medium2. Register a device in the IoT Agent using theLWM2M Command line client

Page 5: Fiware Developers Week Iot exercises (Advanced)

• Prerequisites– Node.js v0.10.x (installed interpreter)– Context Broker knowledge (queries)

• Steps– The goal of this exercise is to try the lazy attribute query

functionalities of the IOT Agents. – Perform the following tasks :

• Provision another device as the one you used in exercise 1, but declare both attributes as lazy.

• Execute the command line LWM2M client.• Create the temperature and humidity objects in the LWM2M client and

assign them a value.• Query the information in the context broker, and compare it to the

value you assigned.• Change the values in the client.• Query the Context broker for the same information.

• Hints– OMA Registry mappings are lazy by default, so there is no

need to declare them in the Device Provisioning.

Medium3. Retrieve information from the LWM2M Client

using the Context Broker (default OMA Registry Mapping).

Page 6: Fiware Developers Week Iot exercises (Advanced)

• Prerequisites– Node.js v0.10.x (installed interpreter)– Context Broker knowledge (updates)

• Steps– The goal of this exercise is to try the lazy attribute update

functionalities of the IOT Agents. – Perform the following tasks :

• Provision another device as the one you used in exercise 1, but declare both attributes as lazy.

• Execute the command line LWM2M client.• Create the temperature and humidity objects in the LWM2M client and

assign them a value.• Query the information of the attributes in the Context Broker and check

against the values you provided.• Update the values in the Context Broker.• Check the values in the client and check against the values you

provided to the Context Broker.

• Hints– OMA Registry mappings are lazy by default, so there is no

need to declare them in the Device Provisioning.

Medium4. Send information to the LWM2M Client usingthe Context Broker

Page 7: Fiware Developers Week Iot exercises (Advanced)

• Prerequisites– Node.js v0.10.x (installed interpreter)– Context Broker knowledge (NGSI9)

• Steps– The goal of this exercise is to learn how to check

for the presence of new Context Providers usingqueries to the Context Broker.

– Perform the following tasks :• Check the context broker availability for Weather

Stations.• Create a new WeatherStation device named ‘weather5’

with id ‘ws5’, with two lazy attributes.• Use the client to register the actual device.• Check the context availability again and check your new

Weather station is available.

• Hints

Medium5. Detect new context providers throughqueries

Page 8: Fiware Developers Week Iot exercises (Advanced)

• Prerequisites– Node.js v0.10.x (installed interpreter)– Context Broker knowledge (NGSI9)

• Steps– The goal of this exercise is to learn how to subscribe to the

creation of new Context Providers in the Context Broker.– Perform the following tasks :

• Create an HTTP server listening to Context Availability notifications onthe WeatherStation types.

• Create a new WeatherStation device named ws6, with two lazyattributes.

• Check the context availability notification has arrived and that theattributes are the ones you created.

• Hints

6. Detect new context providers throughsubscription

Hard

Page 9: Fiware Developers Week Iot exercises (Advanced)

• Prerequisites– Node.js v0.10.x (installed interpreter), Context Broker

knowledge (queries)

• Steps– The goal of this exercise is to provision devices using

mappings that differ from the OMA Registry (or even do notappear in the Registry at all), and lean how to configure additional device provisioning properties.

– Perform the following tasks :• Provision a new device “ws7” with two lazy attributes:

– One called “TheTemperature”, with type “TheType”, that maps to the LWM2M URI /34000/0/5

– Another one called “TheHumidity”, with type “TheOtherType”, that maps tothe LWM2M URI /34000/0/6

• Open the client• Create the /34000/0 object• Set values for the resources with IDs 5 and 6• Register to the IOTAgent• Check the Context Broker for the values you set.

• Hints– Use the ‘internal_attributes’ attribute in the provision.

7. Provision devices with customized attributemapping

Easy

Page 10: Fiware Developers Week Iot exercises (Advanced)

• Prerequisites– Node.js v0.10.x (installed interpreter)– Context Broker knowledge (queries)

• Steps– The goal of this exercise is to show how to configure device groups, so you don’t have

to provision every device you want to connect to the platform.• You will be creating a new group of devices, with the following parameters:• type: HidroponicPot• lazy attributes:

– Humidity– Temperature

• active attributes:– Luminance

• resource: /hidroponic

– Perform the following tasks :• You will be creating a new group of devices, with the following parameters:• type: HidroponicPot• lazy attributes:

– Humidity– Temperature

• active attributes:– Luminance

• resource: /hidroponic

• Hints– You will find all the API operations in the following URL.

https://github.com/telefonicaid/iotagent-node-lib#-configuration-api

8. Provision device groups using theConfiguration API

Easy