2. Connection to the Internet of Things
“Things” mean sensors/actuators
it collects all observations and translates them in data
IoT manages the context information from:
external systems
end users interacting with your application using some web portal
IDAS is an implementation of FIWARE IoT Backend Device Management GE
to connect to Context Broker GE
it translates observations into NGSI events
3. FIWARE IoT Backend Device Management
FIWARE Context Broker
IoT
Agent-1
IoT
Agent-2
IoT
Agent-n
IoT Agent
Manager
create/monitor
FIWARE Backend IoT
Device Management
OMA NGSI API (northbound interface)
(southbound interfaces)
MQTTETSI M2M IETF CoAP
Each IoT Agent handles interaction with a given set of devices
4. Connect any thing
Three way to connect to Context Broker
Context
Broker
Your IoT
IoT
Backend
Gateway GEs Backend GEs
NGSI9/10
B) IoT Backend (IDAS/SBC)
SML, UL2.0, MQTT, ETSIM2M, CoAP/OMA‐LW
NGSI
Proprietary
Zigbee
Zwave
CoAP/MTRunner
ETSIM2M
CoAP/LWM2M
OAuth2.0
5. How to read measures captured from IoT devices
IDAS translates information into NGSI and sends to a Context Broker.
Example - connection of device using UltraLight 2.0 protocol:
Step 1 - know the details of the IDAS (IoT Agent)
Step 2 - create a model for your IoT device
Step 3 - create (register) an asset/device for your IoT device
Step 4 - send observations related to your IoT device
Step 5 - reading measurements sent by your IoT device
6. Connection to the Internet of Things – Step 1
know the details of the IDAS (IoT Agent) you will be sending the measurements to
IP Address (<idas_host>): in this case 130.206.80.47
REST Admin Port (<idas_admin_port>): the port used to access the administrative API of IDAS, 5073
REST Devices Port (<idas_ul20_port>): the port used by your IoT devices to send observations or request
commands, in this case 8002
Service (<service>): IDAS is able to manage different tenants, for instance for different cities or smartspaces. You
can always use our “OpenIoT” service for testing, as we actually do in this example
APIKEY (<apikey>): This is a shared secret your IoT devices need to know prior to communicate to IDAS
regarding a specific Service. Each service/tenant has its own APIKEY, in the case of the testing service “OpenIoT” it
is the string “4jggokgpepnvsb2uv4s40d59ov”
7. Connection to the Internet of Things – Step 2
Create a Model for your IoT device
In the OpenIoT model there are:
SENSOR_TEMP: for a generic Temperature sensor
SENSOR_HUM: for a generic Humidity sensor
SENSOR_LUM: for a generic Illuminance sensor
SENSOR_MOV: for a generic Presence sensor
SENSOR_ZWAVE_4IN1: for the specific Everspring Zwave 4IN1 (Temperature, Humidity, Light, Presence) sensor
8. Connection to the Internet of Things – Step 2
Create an own Model is pretty simple (use REST ADMIN API)
Payload JSON Format:
Check IDAS doc in the Catalogue
TOKEN = FIWARE Oauth Token
Measurements have an “alias”
e.g: Temperature = t
POST <idas_host>:<idas_admin_port>/m2m/v2/services/<service>/models/
(Example: POST: http://130.206.80.47:5073/m2m/v2/services/OpenIoT/models/)
Headers: {'content‐type': 'application/json’; 'X‐Auth‐Token' : <Oauth2.0 TOKEN>}
{ "name": "SENSOR_TEMP",
"capabilities" : [
{ "name" : "Temperature",
"property" : "temperature",
"format" : {
"name" : "Temperature",
"alias" : "t" ,
"phenomenon": "urn:x‐ogc:def:phenomenon:IDAS:1.0:temperature",
"type" : "Quantity",
"uom": "celsius”
} } ],
"protocol": "ul‐2_0”
}
9. Connection to the Internet of Things – Step 3
Create (register) an asset/device for your IoT device (use REST ADMIN API)
Payload JSON Format:
Check IDAS doc in the Catalogue
TOKEN = FIWARE Oauth Token
Must reuse an existing model
DEV_ID = 1st “name”
ASSET_ID = 2nd (asset) “name”
POST <idas_host>:<idas_admin_port>/m2m/v2/services/<service>/assets/
(Example: POST: http://130.206.80.47:5371/m2m/v2/services/OpenIoT/assets/)
Headers: {'content‐type': 'application/json’; 'X‐Auth‐Token' : <Oauth2.0 TOKEN>}
{
"name": "RPI:79:ed:af:zwave:temp:1",
"model": "SENSOR_TEMP",
"asset": {
"name": "TEMP‐LivingRoom",
"description": "asset model protocol”
}
}
10. Connection to the Internet of Things – Step 4
Send observations from IoT device (use UL2.0 DEVICE API)
Payload JSON Format:
TOKEN = FIWARE Oauth Token
DEV_ID = asset name (step 3)
POST:
http://130.206.80.47:8002/d?k=[APIKEY]&i=[DEV_ID]
http://130.206.80.47:8002/d?k=4jggokgpepnvsb2uv4s40d59ov&i=RPI:79:ed:af:zw
ave:temp:1
Headers: {'content‐type': 'application/text’; 'X‐Auth‐Token' : [TOKEN]}
Payload: ‘ t|25‘
Sending multiple measurements with one request (4IN1):
POST:
http://130.206.80.47:8002/d?k=4jggokgpepnvsb2uv4s40d59ov&i=RPI:79:ed:af:4IN
1‐Room
Headers: {'content‐type': 'application/text’; 'X‐Auth‐Token' : [TOKEN]}
Payload: ‘t|23#h|80#l|95#m|Quiet‘
11. Connection to the Internet of Things – Step 5
Read measurements sent by your IoT device
Use NGSI API to read NSGI entity
Entity ID = <asset_name> (TEMP-LivingRoom)
Entity Type = Sensor
Attributes = phenomena (Temperature, Humidity, Light, Presence)
GET <idas_host>:<idas_admin_port>/m2m/v2/services/<service>/assets/
(Example: GET: http://130.206.80.47:5371/m2m/v2/services/OpenIoT/assets/[ASSET_ID])
12. How to act upon IoT devices
Send commands to device:
register command URL (PUSH)
command = true to know what attribute is related
get commands from device (POOLING)
HTTP POST body can be empty or containing a measure
send commands via IDAS ADMIN API
Command XML can be escaped when used in REST API
PUT: <sbc_host>/m2m/v2/services/WorkshopSBC/assets/AssetSemaphoreDemo
Headers: {'content‐type': 'application/json’}
{
"DeviceProps": {
"commandURL": "http://movistarfoto.tid.es:80/CommandSimulator/ping",
"command": "true",
"manufacturer": "Test Manufacturer",
"model": "A123",
"serialNumber": "123456",
"version": "1.0",
}
}
GET or POST:
<idas_host:8002/d?k=5qmnuj9du3qOr3slifhvqgkuif&i=SemaphoreDemo&ip=http://movistarfo
to.tid.es:80/CommandSimulator/ping
tm|32.3
POST: <sbc_host>/m2m/v2/services/WorkshopSBC/assets/AssetSemaphoreDemo/command
{ “commandXML": “<paid:command name=“ping“ />“}