Along with the platform, a set of Node-RED nodes is provided. The aim of those nodes is to ease the development of oneM2M applications. Also, a set of tools such as simulated sensors or actuators to facilitate the development of your IoT applications.
Configuration Nodes
Several nodes are used to configure your node-red.
ORIGINATOR_CONFIG
This node enables to configure and store a specific originator. e.g., you can use it to store the Admin originator configuration.
Different nodes use this config element to have a link to the administrator originator, such as CSE_CONFIG
.
- Name: the name of the node in node-red
- Originator: the actual originator used in the oneM2M requests.
CSE_CONFIG
This node enables to configure a CSE endpoint. You need to provide the point of access (poa) in HTTP
- CSE: Name of the CSE Configuration
- CSE POA: point of access of the CSE. (HTTP)
- CSE ID: the
cse-id
attribute of the CSE. - CSE Name
- admin originator: link to an originator used as administrator entity on the CSE.
AE_CONFIG
Stores the name of an AE in order to ease the deployment and configuration of nodes in node-red.
ACP_CONFIG
Enables to store an ACP resource in order to ease the configuration of other resources and links to a specific ACP.
ACR_CONFIG
This config node enables to store all informations for an Access Control Rule specification.
-
Originator: Specification of the originator concerned by this rule. WIP: integrate a list of originators to enable the specification of several originators for the same rule.
-
Rights: Several rights can be enabled or disabled for the specific rule. Those rights are: Create, Retrieve, Update, Delete, Discovery, Notify. By default, all the rights are enabled in the node.
oneM2M nodes:
Access Control Policy (ACP)
Attributes:
- ACP: name of the ACP resource
- CSE: link to the configured CSE
- ACR PV: access control rule for privileges. WIP: possibility to specify multiple ACR.
- ACR PVS: access control rules for self-privileges. WIP: possibility to specify multiple ACR.
Application Entity (AE)
Attributes:
- Name
- CSE: link to the CSE Configuration
- Application: link to the AE Configuration
- Application ID: identifier of the app, used in the
api
oneM2M parameter.
Input:
- msg: nothing in particular is used from the msg.
Output:
- msg.payload: the body of the response of the HTTP request.
Behaviour: When receiving a msg, the node will try to create the configured AE on the chosen CSE. If the resource is already created, an error will occur and the node will indicate that the resource already exists. WIP: add a configuration option to reset the AE if it is already present in the CSE.
Container Node (CNT)
Attributes:
- CSE: link to the configured CSE
- AE: link to the parent AE (name). WIP: integrate the possibility to have CSE as the parent of the resource.
- CNT Name: name of the oneM2M resource to create.
- Max Number of Instances: maximum number of content instances to store in the created container. If this number is reached, the next content instance will erase the older one stored in the container.
- ACP: WIP possible link to a specific ACP.
Input:
- msg to trigger the request.
Output:
- msg.payload: body of the HTTP response
- msg.headers: headers of the HTTP response
- msg.error: errors if any
Behaviour:
- Receive input message
- Try to create the configured CNT oneM2M resource.
- If the ressource already exists or if any error occurs, the node indicate it.
Content Instance (CIN)
Attributes:
- CSE: link to the CSE to send the requests
- Parent: uri to the parent resource. For now you can use the hierarchical or non hierarchical uri. WIP: integrate some preconfigured URI patterns for parent resource.
- Content Format: format of the content to be stored in the content instance
- Name: name of the node-red node
Input:
- msg.contentFormat: can be used to indicate a specific content format
- msg.payload: the value to be stored in the content instance. Use the format you want.
Output:
- msg.error: if any error occurs
- msg.payload: error.code or the body of the HTTP response
- msg.headers: headers of the HTTP response
- msg.payloadType:
"m2m:cin"
Behaviour:
- Receive a content via msg.
- send the content instance creation request in HTTP to the CSE
- the value is stored in the CSE
Content Extractor
Attributes:
- Name of the node-red node
Input:
- msg.payloadType:
"m2m:cin"
or"m2m:sgn"
. This value is automatically assigned by the Smart Sensor node and Content Instance node. - msg.payload: the content instance or notification in json (string).
Output:
- msg.paylaod: the content of the content instance (value of the attribue
con
of the concerned content instance).
Behaviour: Basically, the node checks the payload Type and then perform the extraction of the content attribute. If any parsing error is catched, it is logged in the console but not sent to the output, this way you can use this node in your flows to trigger behaviors based on the value.
Named Sensor Data
Attributes:
- CSE
- AE: link to the oneM2M AE representing the Sensor
- Container(s) name(s): name of the container. This may be a set of subcontainers such as CNT1/SUBCNT1/SUBSUBCNT1. The names must be formatted as in the hierarchical uri.
- Content Instance: indicate if you want to retrieve the latest or the oldest content instance contained in the specified container of the AE.
- Name of the node-red node
Input:
- msg: trigger the retrieve request
Output:
- msg.error if any
- msg.payload: error or body of the HTTP response (Content instance)
- msg.headers: headers of the http response
- msg.payloadType: fixed to
"m2m:cin"
if the retrieval of the content instance is successful.
Behaviour: On trigger the node will send a RETRIEVE request to the oneM2M CSE to get the latest or the oldest content instance stored in the container of the specified AE.
Developper tools nodes:
Fake Sensor
Attributes:
- Name of the node-red node
- Min value: minimal value for the range of values of the sensor.
- Max value: maximum value for the range of values of the sensor.
Input:
- msg: trigger the node
Output:
- msg.payload: a random raw value picked in the range specified in the configration of the node.
Behaviour: When triggered, the node will return a random value between max value and min value. This node can be used to have some values as an input to test your system. N.B.: this node does not create any oneM2M resources. you can use it in complement with the content instance node if you want to store the generated value in a CSE.
Fake Actuator
Attributes:
- Name of the node-red node Input:
- msg.payload: the fake device will turn on if the payload equals
true
or if the payload contains:"true"
or"on"
.
Output:
- msg.payload:
"on"
or"off"
. Can be used as an input for the content instance node.
Behaviour:
- Receive a msg.
- Turn ON or OFF the fake device.
- Send the new state as output msg.
Smart Sensor
This node emulates a smart sensor that embeds a oneM2M client (oneM2M ADN). Attributes:
- Name of the node-red node
- min value: minimum value for the radom value to be generated
- max value
- CSE: linked CSE to send requests to
- Application: AE resource name. The resource may exists already or not in the CSE
- Application ID: app id of the oneM2M resource to be created
- point of access: may be empty. specify here any endpoint you may have to receive notifications. WIP: update to use a checkbox to activate or deactivate the poa.
- labels: indicate here any labels for the AE. For now, you can only use 1 label. WIP: support multiple labels
- Max number of instances: maximum number of instances to be stored in the CSE.
- Content format of the stored value.
- Reset AE if exists: if checked, the node will delete any existing AE with the same resource name than the specified AE Name.
Input:
- msg.sensorValue: can be used to inject a specific raw value for the smart sensor. Can be used to work with specific value or dataset loaded from file, etc.
Output:
- msg.payload: the response body of the HTTP requests
- msg.headers: headers of the HTTP response
- msg.statusCode: status code of the HTTP response
- msg.error: if any
Behavior:
This node will create all the needed oneM2M resources on the first received message. If checked, it will delete all the existing resources before creating them. After that, the node will inject random values as content instances on each received msg. However, if a value is specified in the input message (msg.sensorValue
) the node will use this value instead of generating a random one.
The output of the node can be used with the content extractor.