iotagent-node-lib 2.18.0 → 2.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/.github/workflows/ci.yml +1 -2
  2. package/.nyc_output/76bc24ff-5fac-4b5a-997d-de2799342eb0.json +1 -0
  3. package/.nyc_output/processinfo/76bc24ff-5fac-4b5a-997d-de2799342eb0.json +1 -0
  4. package/.nyc_output/processinfo/index.json +1 -0
  5. package/.readthedocs.yml +3 -1
  6. package/CHANGES_NEXT_RELEASE +1 -0
  7. package/README.md +5 -56
  8. package/doc/advanced-topics.md +121 -85
  9. package/doc/api.md +63 -54
  10. package/doc/development.md +8 -9
  11. package/doc/expressionLanguage.md +517 -316
  12. package/doc/installationguide.md +66 -64
  13. package/doc/northboundinteractions.md +40 -33
  14. package/doc/requirements.txt +4 -0
  15. package/{docs → doc}/roadmap.md +21 -6
  16. package/doc/usermanual.md +50 -18
  17. package/docker/Mosquitto/Dockerfile +28 -11
  18. package/docker/Mosquitto/README.md +8 -6
  19. package/docker/Mosquitto/startMosquitto.sh +14 -4
  20. package/lib/fiware-iotagent-lib.js +4 -2
  21. package/lib/jexlTranformsMap.js +11 -1
  22. package/lib/model/Device.js +4 -1
  23. package/lib/model/Group.js +19 -1
  24. package/lib/plugins/expressionParser.js +6 -4
  25. package/lib/plugins/expressionPlugin.js +63 -22
  26. package/lib/plugins/jexlParser.js +3 -1
  27. package/lib/plugins/multiEntity.js +2 -21
  28. package/lib/request-shim.js +111 -0
  29. package/lib/services/common/domain.js +6 -2
  30. package/lib/services/common/genericMiddleware.js +6 -2
  31. package/lib/services/common/iotManagerService.js +1 -1
  32. package/lib/services/common/securityServiceKeystone.js +1 -1
  33. package/lib/services/common/securityServiceOAuth2.js +3 -2
  34. package/lib/services/devices/deviceRegistryMemory.js +13 -2
  35. package/lib/services/devices/deviceRegistryMongoDB.js +16 -7
  36. package/lib/services/devices/deviceService.js +26 -2
  37. package/lib/services/devices/devices-NGSI-LD.js +1 -1
  38. package/lib/services/devices/devices-NGSI-v2.js +2 -6
  39. package/lib/services/devices/registrationUtils.js +0 -2
  40. package/lib/services/ngsi/entities-NGSI-LD.js +97 -11
  41. package/lib/services/ngsi/entities-NGSI-v2.js +95 -8
  42. package/lib/services/ngsi/ngsiService.js +5 -4
  43. package/lib/services/northBound/contextServer-NGSI-LD.js +3 -2
  44. package/lib/services/northBound/contextServer-NGSI-v2.js +32 -27
  45. package/lib/services/northBound/contextServerUtils.js +1 -1
  46. package/lib/services/northBound/deviceProvisioningServer.js +31 -6
  47. package/lib/services/northBound/northboundServer.js +2 -0
  48. package/lib/services/northBound/restUtils.js +1 -1
  49. package/lib/templates/createDevice.json +12 -0
  50. package/lib/templates/updateDevice.json +12 -0
  51. package/package.json +9 -15
  52. package/test/tools/utils.js +2 -0
  53. package/test/unit/expressions/jexlExpression-test.js +5 -5
  54. package/test/unit/general/contextBrokerKeystoneSecurityAccess-test.js +1 -1
  55. package/test/unit/general/deviceService-test.js +2 -5
  56. package/test/unit/general/loglevel-api_test.js +6 -11
  57. package/test/unit/general/startup-test.js +1 -0
  58. package/test/unit/memoryRegistry/deviceRegistryMemory_test.js +1 -0
  59. package/test/unit/mongodb/mongodb-group-registry-test.js +1 -1
  60. package/test/unit/mongodb/mongodb-registry-test.js +2 -1
  61. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin12a.json +7 -0
  62. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin13.json +13 -13
  63. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin1a.json +18 -0
  64. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin29.json +18 -0
  65. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin31.json +15 -0
  66. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin32.json +17 -0
  67. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin33.json +18 -0
  68. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin34.json +17 -0
  69. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin4a.json +36 -0
  70. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin7.json +16 -16
  71. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin8a.json +18 -0
  72. package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin15.json +25 -0
  73. package/test/unit/ngsi-ld/expressions/jexlBasedTransformations-test.js +1018 -0
  74. package/test/unit/ngsi-ld/general/contextBrokerOAuthSecurityAccess-test.js +2 -2
  75. package/test/unit/ngsi-ld/general/deviceService-test.js +1 -1
  76. package/test/unit/ngsi-ld/general/https-support-test.js +2 -1
  77. package/test/unit/ngsi-ld/general/iotam-autoregistration-test.js +2 -1
  78. package/test/unit/ngsi-ld/general/startup-test.js +1 -0
  79. package/test/unit/ngsi-ld/lazyAndCommands/active-devices-attribute-update-test.js +3 -1
  80. package/test/unit/ngsi-ld/lazyAndCommands/command-test.js +2 -1
  81. package/test/unit/ngsi-ld/lazyAndCommands/lazy-devices-test.js +2 -6
  82. package/test/unit/ngsi-ld/lazyAndCommands/polling-commands-test.js +2 -1
  83. package/test/unit/ngsi-ld/ngsiService/active-devices-test.js +1 -0
  84. package/test/unit/ngsi-ld/ngsiService/autocast-test.js +1 -0
  85. package/test/unit/ngsi-ld/ngsiService/geoproperties-test.js +1 -0
  86. package/test/unit/ngsi-ld/ngsiService/subscriptions-test.js +4 -3
  87. package/test/unit/ngsi-ld/plugins/alias-plugin_test.js +1 -0
  88. package/test/unit/ngsi-ld/plugins/bidirectional-plugin_test.js +3 -2
  89. package/test/unit/ngsi-ld/plugins/multientity-plugin_test.js +61 -0
  90. package/test/unit/ngsi-ld/provisioning/device-provisioning-api_test.js +2 -1
  91. package/test/unit/ngsi-ld/provisioning/device-registration_test.js +3 -2
  92. package/test/unit/ngsi-ld/provisioning/device-update-registration_test.js +1 -0
  93. package/test/unit/ngsi-ld/provisioning/listProvisionedDevices-test.js +42 -54
  94. package/test/unit/ngsi-ld/provisioning/provisionDeviceMultientity-test.js +2 -1
  95. package/test/unit/ngsi-ld/provisioning/removeProvisionedDevice-test.js +4 -4
  96. package/test/unit/ngsi-ld/provisioning/singleConfigurationMode-test.js +3 -5
  97. package/test/unit/ngsi-ld/provisioning/updateProvisionedDevices-test.js +12 -18
  98. package/test/unit/ngsi-mixed/provisioning/ngsi-versioning-test.js +3 -1
  99. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin17.json +1 -1
  100. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin32.json +16 -0
  101. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin33.json +22 -0
  102. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin34.json +12 -0
  103. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin35.json +2 -0
  104. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin36.json +1 -0
  105. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin15.json +25 -0
  106. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin16.json +25 -0
  107. package/test/unit/ngsiv2/expressions/expressionBasedTransformations-test.js +4 -4
  108. package/test/unit/ngsiv2/expressions/jexlBasedTransformations-test.js +561 -0
  109. package/test/unit/ngsiv2/general/contextBrokerOAuthSecurityAccess-test.js +3 -2
  110. package/test/unit/ngsiv2/general/deviceService-test.js +9 -8
  111. package/test/unit/ngsiv2/general/https-support-test.js +2 -1
  112. package/test/unit/ngsiv2/general/iotam-autoregistration-test.js +2 -1
  113. package/test/unit/ngsiv2/general/startup-test.js +1 -0
  114. package/test/unit/ngsiv2/lazyAndCommands/active-devices-attribute-update-test.js +3 -1
  115. package/test/unit/ngsiv2/lazyAndCommands/command-test.js +2 -1
  116. package/test/unit/ngsiv2/lazyAndCommands/lazy-devices-test.js +14 -18
  117. package/test/unit/ngsiv2/lazyAndCommands/polling-commands-test.js +3 -1
  118. package/test/unit/ngsiv2/ngsiService/active-devices-test.js +1 -0
  119. package/test/unit/ngsiv2/ngsiService/queryDeviceInformationInCb-test.js +0 -1
  120. package/test/unit/ngsiv2/ngsiService/subscriptions-test.js +4 -3
  121. package/test/unit/ngsiv2/plugins/bidirectional-plugin_test.js +3 -2
  122. package/test/unit/ngsiv2/plugins/multientity-plugin_test.js +210 -0
  123. package/test/unit/ngsiv2/plugins/translation-inPlugins_test.js +1 -1
  124. package/test/unit/ngsiv2/provisioning/device-group-api-test.js +3 -2
  125. package/test/unit/ngsiv2/provisioning/device-group-utils-test.js +2 -1
  126. package/test/unit/ngsiv2/provisioning/device-provisioning-api_test.js +2 -1
  127. package/test/unit/ngsiv2/provisioning/device-registration_test.js +3 -2
  128. package/test/unit/ngsiv2/provisioning/device-update-registration_test.js +4 -3
  129. package/test/unit/ngsiv2/provisioning/listProvisionedDevices-test.js +42 -53
  130. package/test/unit/ngsiv2/provisioning/provisionDeviceMultientity-test.js +2 -1
  131. package/test/unit/ngsiv2/provisioning/removeProvisionedDevice-test.js +4 -4
  132. package/test/unit/ngsiv2/provisioning/singleConfigurationMode-test.js +3 -4
  133. package/test/unit/ngsiv2/provisioning/updateProvisionedDevices-test.js +13 -19
  134. package/test/unit/plugins/capture-configuration-inPlugins_test.js +3 -1
  135. package/test/unit/plugins/capture-provision-inPlugins_test.js +2 -1
  136. package/bin/agentConsole.js +0 -257
  137. package/bin/iotAgentTester.js +0 -44
  138. package/lib/command/commandLine.js +0 -918
  139. package/lib/command/migration.js +0 -176
  140. package/test/unit/general/migration-test.js +0 -256
  141. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin20.json +0 -25
package/doc/api.md CHANGED
@@ -75,26 +75,26 @@ information configured:
75
75
  The table below shows the information held in the service group provisioning resource. The table also contains the
76
76
  correspondence between the API resource fields and the same fields in the database model.
77
77
 
78
- | Payload Field | DB Field | Definition |
79
- | ------------------------------ | ------------------------------ | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
80
- | `service` | `service` | Service of the devices of this type |
81
- | `subservice` | `subservice` | Subservice of the devices of this type. |
82
- | `resource` | `resource` | string representing the Southbound resource that will be used to assign a type to a device (e.g.: pathname in the southbound port). |
83
- | `apikey` | `apikey` | API Key string. |
84
- | `timestamp` | `timestamp` | Optional flag about whether or not to add the `TimeInstant` attribute to the device entity created, as well as a `TimeInstant` metadata to each attribute, with the current timestamp. With NGSI-LD, the Standard `observedAt` property-of-a-property is created instead. | true |
85
- | `entity_type` | `entity_type` | name of the Entity `type` to assign to the group. |
86
- | `trust` | `trust` | trust token to use for secured access to the Context Broker for this type of devices (optional; only needed for secured scenarios). |
87
- | `cbHost` | `cbHost` | Context Broker connection information. This options can be used to override the global ones for specific types of devices. |
88
- | `lazy` | `lazy` | list of common lazy attributes of the device. For each attribute, its `name` and `type` must be provided. |
89
- | `commands` | `commands` | list of common commands attributes of the device. For each attribute, its `name` and `type` must be provided, additional `metadata` is optional. |
90
- | `attributes` | `attributes` | list of common active attributes of the device. For each attribute, its `name` and `type` must be provided, additional `metadata` is optional. |
91
- | `static_attributes` | `staticAttributes` | this attributes will be added to all the entities of this group 'as is', additional `metadata` is optional. |
92
- | `internal_attributes` | `internalAttributes` | optional section with free format, to allow specific IoT Agents to store information along with the devices in the Device Registry. |
93
- | `expressionLanguage` | `expresionLanguage` | optional boolean value, to set expression language used to compute expressions, possible values are: legacy or jexl. When not set or wrongly set, `legacy` is used as default value. |
94
- | `explicitAttrs` | `explicitAttrs` | optional boolean value, to support selective ignore of measures so that IOTA doesn’t progress. If not specified default is `false`. |
95
- | `ngsiVersion` | `ngsiVersion` | optional string value used in mixed mode to switch between **NGSI-v2** and **NGSI-LD** payloads. Possible values are: `v2` or `ld`. The default is `v2`. When not running in mixed mode, this field is ignored. |
96
- | `defaultEntityNameConjunction` | `defaultEntityNameConjunction` | optional string value to set default conjunction string used to compose a default `entity_name` when is not provided at device provisioning time. |
97
- | `autoprovision` | `autoprovision` | optional boolean: If `false`, autoprovisioned devices (i.e. devices that are not created with an explicit provision operation but when the first measure arrives) are not allowed in this group. Default (in the case of omitting the field) is `true`. |
78
+ | Payload Field | DB Field | Definition |
79
+ | ------------------------------ | ------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
80
+ | `service` | `service` | Service of the devices of this type |
81
+ | `subservice` | `subservice` | Subservice of the devices of this type. |
82
+ | `resource` | `resource` | string representing the Southbound resource that will be used to assign a type to a device (e.g.: pathname in the southbound port). |
83
+ | `apikey` | `apikey` | API Key string. |
84
+ | `timestamp` | `timestamp` | Optional flag about whether or not to add the `TimeInstant` attribute to the device entity created, as well as a `TimeInstant` metadata to each attribute, with the current timestamp. With NGSI-LD, the Standard `observedAt` property-of-a-property is created instead. | true |
85
+ | `entity_type` | `entity_type` | name of the Entity `type` to assign to the group. |
86
+ | `trust` | `trust` | trust token to use for secured access to the Context Broker for this type of devices (optional; only needed for secured scenarios). |
87
+ | `cbHost` | `cbHost` | Context Broker connection information. This options can be used to override the global ones for specific types of devices. |
88
+ | `lazy` | `lazy` | list of common lazy attributes of the device. For each attribute, its `name` and `type` must be provided. |
89
+ | `commands` | `commands` | list of common commands attributes of the device. For each attribute, its `name` and `type` must be provided, additional `metadata` is optional. |
90
+ | `attributes` | `attributes` | list of common active attributes of the device. For each attribute, its `name` and `type` must be provided, additional `metadata` is optional. |
91
+ | `static_attributes` | `staticAttributes` | this attributes will be added to all the entities of this group 'as is', additional `metadata` is optional. |
92
+ | `internal_attributes` | `internalAttributes` | optional section with free format, to allow specific IoT Agents to store information along with the devices in the Device Registry. |
93
+ | `expressionLanguage` | `expresionLanguage` | optional boolean value, to set expression language used to compute expressions, possible values are: legacy or jexl. When not set or wrongly set, `legacy` is used as default value. |
94
+ | `explicitAttrs` | `explicitAttrs` | optional field to support selective ignore of measures so that IOTA doesn’t progress. See details in [specific section](advanced-topics.md#explicitly-defined-attributes-explicitattrs) |
95
+ | `ngsiVersion` | `ngsiVersion` | optional string value used in mixed mode to switch between **NGSI-v2** and **NGSI-LD** payloads. Possible values are: `v2` or `ld`. The default is `v2`. When not running in mixed mode, this field is ignored. |
96
+ | `defaultEntityNameConjunction` | `defaultEntityNameConjunction` | optional string value to set default conjunction string used to compose a default `entity_name` when is not provided at device provisioning time. |
97
+ | `autoprovision` | `autoprovision` | optional boolean: If `false`, autoprovisioned devices (i.e. devices that are not created with an explicit provision operation but when the first measure arrives) are not allowed in this group. Default (in the case of omitting the field) is `true`. |
98
98
 
99
99
  ### Service Group Endpoint
100
100
 
@@ -205,49 +205,49 @@ Note that there is a 1:1 correspondence between payload fields and DB fields (bu
205
205
 
206
206
  ### Relationship between service groups and devices
207
207
 
208
- Devices may be associated to exisiting service groups (or not) based in `apiKey` matching or `type` matching (in the case `apiKey`
209
- matching fails). For instance, let's consider a situation in which a service group has been provisioned with `type=X`/`apiKey=111`
210
- and no other service group has been provisioned.
208
+ Devices may be associated to exisiting service groups (or not) based in `apiKey` matching or `type` matching (in the
209
+ case `apiKey` matching fails). For instance, let's consider a situation in which a service group has been provisioned
210
+ with `type=X`/`apiKey=111` and no other service group has been provisioned.
211
211
 
212
- * IoT Agent receives an anonymous measure with `apiKey=111`. The matching `apiKey` means the entity inherits from service group.
213
- Device entity has `type=X` and `apiKey=111`
214
- * IoT Agent receives a provisioning request for an explicit device of `type=Y`/`apiKey=111`. The matching `apiKey` means the entity
215
- inherits from service group but type is overridden. Device entity has `type=Y` and `apiKey=111`
216
- * IoT Agent receives a provisioning request for an explicit device of `type=X`/`apiKey=222`. The matching `type` means the entity
217
- inherits from service group but `apiKey` is overridden. Device entity has `type=X` and `apiKey=222`.
218
- * IoT Agent receives a provisioning request for an explicit device of `type=Y`/`apiKey=222`. No matching. Device entity has `type=Y`
219
- and `apiKey=222` and no service group.
212
+ - IoT Agent receives an anonymous measure with `apiKey=111`. The matching `apiKey` means the entity inherits from
213
+ service group. Device entity has `type=X` and `apiKey=111`
214
+ - IoT Agent receives a provisioning request for an explicit device of `type=Y`/`apiKey=111`. The matching `apiKey`
215
+ means the entity inherits from service group but type is overridden. Device entity has `type=Y` and `apiKey=111`
216
+ - IoT Agent receives a provisioning request for an explicit device of `type=X`/`apiKey=222`. The matching `type` means
217
+ the entity inherits from service group but `apiKey` is overridden. Device entity has `type=X` and `apiKey=222`.
218
+ - IoT Agent receives a provisioning request for an explicit device of `type=Y`/`apiKey=222`. No matching. Device
219
+ entity has `type=Y` and `apiKey=222` and no service group.
220
220
 
221
221
  ### Device model
222
222
 
223
223
  The table below shows the information held in the Device resource. The table also contains the correspondence between
224
224
  the API resource fields and the same fields in the database model.
225
225
 
226
- | Payload Field | DB Field | Definition | Example of value |
227
- | --------------------- | -------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------- |
228
- | `device_id` | `id` | Device ID that will be used to identify the device. | UO834IO |
229
- | `service` | `service` | Name of the service the device belongs to (will be used in the fiware-service header). | smartGondor |
230
- | `service_path` | `subservice` | Name of the subservice the device belongs to (used in the fiware-servicepath header). | /gardens |
231
- | `entity_name` | `name` | Name of the entity representing the device in the Context Broker | ParkLamplight12 |
232
- | `entity_type` | `type` | Type of the entity in the Context Broker | Lamplights |
233
- | `timezone` | `timezone` | Time zone of the sensor if it has any | America/Santiago |
234
- | `timestamp` | `timestamp` | Optional flag about whether or not to add the `TimeInstant` attribute to the device entity created, as well as a `TimeInstant` metadata to each attribute, with the current timestamp. With NGSI-LD, the Standard `observedAt` property-of-a-property is created instead. | true |
235
- | `apikey` | `apikey` | Optional Apikey key string to use instead of group apikey | 9n4hb1vpwbjozzmw9f0flf9c2 |
236
- | `endpoint` | `endpoint` | Endpoint where the device is going to receive commands, if any. | http://theDeviceUrl:1234/commands |
237
- | `protocol` | `protocol` | Name of the device protocol, for its use with an IoT Manager. | IoTA-UL |
238
- | `transport` | `transport` | Name of the device transport protocol, for the IoT Agents with multiple transport protocols. | MQTT |
239
- | `attributes` | `active` | List of active attributes of the device | `[ { "name": "attr_name", "type": "Text" } ]` |
240
- | `lazy` | `lazy` | List of lazy attributes of the device | `[ { "name": "attr_name", "type": "Text" } ]` |
241
- | `commands` | `commands` | List of commands of the device | `[ { "name": "attr_name", "type": "Text" } ]` |
242
- | `internal_attributes` | `internalAttributes` | List of internal attributes with free format for specific IoT Agent configuration | LWM2M mappings from object URIs to attributes |
243
- | `static_attributes` | `staticAttributes` | List of static attributes to append to the entity. All the updateContext requests to the CB will have this set of attributes appended. | `[ { "name": "attr_name", "type": "Text" } ]` |
244
- | `expressionLanguage` | `expresionLanguage` | optional boolean value, to set expression language used to compute expressions, possible values are: legacy or jexl. When not set or wrongly set, legacy is used as default value. |
245
- | `explicitAttrs` | `explicitAttrs` | Boolean value to support selective ignore of measures for device so that IOTA doesn’t progress. If not specified default is `false`. | `true/false` |
246
- | `ngsiVersion` | `ngsiVersion` | optional string value used in mixed mode to switch between **NGSI-v2** and **NGSI-LD** payloads. The default is `v2`. When not running in mixed mode, this field is ignored. | `v2/ld` |
226
+ | Payload Field | DB Field | Definition | Example of value |
227
+ | --------------------- | -------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :-------------------------------------------- |
228
+ | `device_id` | `id` | Device ID that will be used to identify the device. | UO834IO |
229
+ | `service` | `service` | Name of the service the device belongs to (will be used in the fiware-service header). | smartGondor |
230
+ | `service_path` | `subservice` | Name of the subservice the device belongs to (used in the fiware-servicepath header). | /gardens |
231
+ | `entity_name` | `name` | Name of the entity representing the device in the Context Broker | ParkLamplight12 |
232
+ | `entity_type` | `type` | Type of the entity in the Context Broker | Lamplights |
233
+ | `timezone` | `timezone` | Time zone of the sensor if it has any | America/Santiago |
234
+ | `timestamp` | `timestamp` | Optional flag about whether or not to add the `TimeInstant` attribute to the device entity created, as well as a `TimeInstant` metadata to each attribute, with the current timestamp. With NGSI-LD, the Standard `observedAt` property-of-a-property is created instead. | true |
235
+ | `apikey` | `apikey` | Optional Apikey key string to use instead of group apikey | 9n4hb1vpwbjozzmw9f0flf9c2 |
236
+ | `endpoint` | `endpoint` | Endpoint where the device is going to receive commands, if any. | http://theDeviceUrl:1234/commands |
237
+ | `protocol` | `protocol` | Name of the device protocol, for its use with an IoT Manager. | IoTA-UL |
238
+ | `transport` | `transport` | Name of the device transport protocol, for the IoT Agents with multiple transport protocols. | MQTT |
239
+ | `attributes` | `active` | List of active attributes of the device | `[ { "name": "attr_name", "type": "Text" } ]` |
240
+ | `lazy` | `lazy` | List of lazy attributes of the device | `[ { "name": "attr_name", "type": "Text" } ]` |
241
+ | `commands` | `commands` | List of commands of the device | `[ { "name": "attr_name", "type": "Text" } ]` |
242
+ | `internal_attributes` | `internalAttributes` | List of internal attributes with free format for specific IoT Agent configuration | LWM2M mappings from object URIs to attributes |
243
+ | `static_attributes` | `staticAttributes` | List of static attributes to append to the entity. All the updateContext requests to the CB will have this set of attributes appended. | `[ { "name": "attr_name", "type": "Text" } ]` |
244
+ | `expressionLanguage` | `expresionLanguage` | optional boolean value, to set expression language used to compute expressions, possible values are: legacy or jexl. When not set or wrongly set, legacy is used as default value. |
245
+ | `explicitAttrs` | `explicitAttrs` | optional field to support selective ignore of measures so that IOTA doesn’t progress. See details in [specific section](advanced-topics.md#explicitly-defined-attributes-explicitattrs) | (see details in specific section) |
246
+ | `ngsiVersion` | `ngsiVersion` | optional string value used in mixed mode to switch between **NGSI-v2** and **NGSI-LD** payloads. The default is `v2`. When not running in mixed mode, this field is ignored. | `v2/ld` |
247
247
 
248
248
  #### Attribute lists
249
249
 
250
- In the device model there are three list of attributes that can be declared: attributes, lazy and commands. All of them
250
+ In the group/device model there are three list of attributes that can be declared: attributes, lazy and commands. All of them
251
251
  have the same syntax, an object containing the following attributes:
252
252
 
253
253
  - **object_id** (optional): name of the attribute as coming from the device.
@@ -255,7 +255,7 @@ have the same syntax, an object containing the following attributes:
255
255
  - **type** (mandatory): name of the type of the attribute in the target entity.
256
256
  - **metadata** (optional): additional static metadata for the attribute in the target entity. (e.g. `unitCode`)
257
257
 
258
- Some transformation plugins also allow the use of the following optional attributes:
258
+ Some transformation plugins also allow the use of the following optional fields:
259
259
 
260
260
  - **expression**: indicates that the value of the target attribute will not be the plain value or the measurement, but
261
261
  an expression based on a combination of the reported values. See the
@@ -268,6 +268,15 @@ Some transformation plugins also allow the use of the following optional attribu
268
268
  - **reverse**: add bidirectionality expressions to the attribute. See the **bidirectionality** transformation plugin
269
269
  in the [Data Mapping Plugins section](advanced-topics.md#bidirectionality-plugin-bidirectional) for details.
270
270
 
271
+ Additionally for commands (which are attributes of type `command`) the following fields are optional:
272
+
273
+ - **expression** indicates that the value of the target command will not be the plain value or the command, but an
274
+ expression based on a combination of the returned values. See the
275
+ [Expression Language definition](expressionLanguage.md) for details
276
+ - **payloadType**: indicates how command payload will be transformed before be sent to device. Please have a look to particular
277
+ IOTAs documentation for allowed values of this field in each case.
278
+ - **contentType**: `content-type` header used when send command by HTTP transport (ignored in other kinds of transports)
279
+
271
280
  See the transformation plugins Section for more details.
272
281
 
273
282
  #### Advice on Attribute defintions
@@ -27,15 +27,15 @@ The following sections show the available options in detail.
27
27
 
28
28
  ### Environment requirements
29
29
 
30
- A [MongoDB](https://www.mongodb.com/) 3.2+ instance is required to run tests.
31
- You can deploy one by using the commodity `docker-compose-dev.yml`:
30
+ A [MongoDB](https://www.mongodb.com/) 3.2+ instance is required to run tests. You can deploy one by using the commodity
31
+ `docker-compose-dev.yml`:
32
32
 
33
33
  ```
34
34
  docker-compose -f docker-compose-dev.yml up -d
35
35
  ```
36
36
 
37
- To run docker compose you will need [docker](https://docs.docker.com/get-docker/)
38
- and [docker-compose](https://docs.docker.com/compose/install/).
37
+ To run docker compose you will need [docker](https://docs.docker.com/get-docker/) and
38
+ [docker-compose](https://docs.docker.com/compose/install/).
39
39
 
40
40
  ### Testing
41
41
 
@@ -51,14 +51,13 @@ To run tests, type
51
51
  npm test
52
52
  ```
53
53
 
54
- There are additional targets starting with `test:` prefix to run specific test subsets isolatedly. For instance,
55
- the `test:expressions` target runs the subset of tests related with expression language feature:
54
+ There are additional targets starting with `test:` prefix to run specific test subsets isolatedly. For instance, the
55
+ `test:expressions` target runs the subset of tests related with expression language feature:
56
56
 
57
57
  ```bash
58
58
  npm run test:expressions
59
59
  ```
60
60
 
61
-
62
61
  ### Debug Test
63
62
 
64
63
  To debug the code while running run tests, type
@@ -67,8 +66,8 @@ To debug the code while running run tests, type
67
66
  npm run test:debug
68
67
  ```
69
68
 
70
- In the console the link to the debugger will be provided. You can connect
71
- to it via Chrome, for example, by opening the following url: ```chrome://inspect```.
69
+ In the console the link to the debugger will be provided. You can connect to it via Chrome, for example, by opening the
70
+ following url: `chrome://inspect`.
72
71
 
73
72
  Additional debug clients are listed on [node.js](https://nodejs.org/en/docs/guides/debugging-getting-started/).
74
73