Skip to content

Commit

Permalink
Merge pull request #1686 from telefonicaid/task/allow_clear_last_measure
Browse files Browse the repository at this point in the history
Task/allow clear last measure
  • Loading branch information
fgalan authored Jan 20, 2025
2 parents 2d42d6a + cf48eaa commit 1303bda
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
- Add: option to force to use CB flow control with new API field useCBflowControl at group and device device level (#1420)
- Add: useCBflowControl config setting (IOTA_CB_FLOW_CONTROL env var) to set CB flow control behaviour at instance level (#1420)
- Add: allow remove last measure in device
- Add: store last measure in device (by id, apikey, service and subservice) and new API field storeLastMeasure at group and device levels (#1669)
- Add: storeLastMeasure config setting (IOTA_STORE_LAST_MEASURE env var) to set default store last measure behaviour at instance level (#1669)
- Upgrade express dep from 4.19.2 to 4.21.2
Expand Down
2 changes: 1 addition & 1 deletion doc/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2000,7 +2000,7 @@ the API resource fields and the same fields in the database model.
| `ngsiVersion` || `string` | | 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. |
| `payloadType` || `string` | | optional string value used to switch between **IoTAgent**, **NGSI-v2** and **NGSI-LD** measure payloads types. Possible values are: `iotagent`, `ngsiv2` or `ngsild`. The default is `iotagent`. |
| `storeLastMeasure` || `boolean` | | Store in device last measure received. See more info [in this section](admin.md#storelastmeasure). False by default. |
| `lastMeasure` || `object` | | last measure stored on device when `storeLastMeasure` is enabled. See more info [in this section](admin.md#storelastmeasure). |
| `lastMeasure` || `object` | | last measure stored on device when `storeLastMeasure` is enabled. See more info [in this section](admin.md#storelastmeasure). This field can be cleared using `{}` in a device update request. In that case, `lastMeasure` is removed from device (until a next measure is recieved and `lastMesuare` gets created again). |
| `useCBflowControl` || `boolean` | | Use Context Broker flow control. See more info [in this section](admin.md#useCBflowControl). False by default. |
### Device operations

Expand Down
1 change: 1 addition & 0 deletions lib/services/devices/deviceRegistryMongoDB.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ function update(previousDevice, device, callback) {
data.payloadType = device.payloadType;
data.useCBflowControl = device.useCBflowControl;
data.storeLastMeasure = device.storeLastMeasure;
data.lastMeasure = device.lastMeasure;

/* eslint-disable-next-line new-cap */
const deviceObj = new Device.model(data);
Expand Down
4 changes: 4 additions & 0 deletions lib/templates/updateDevice.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@
"storeLastMeasure": {
"description": "Store last measure",
"type": "boolean"
},
"lastMeasure": {
"description": "last measure",
"type": "object"
}
}
}
4 changes: 4 additions & 0 deletions lib/templates/updateDeviceLax.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@
"storeLastMeasure": {
"description": "Store last measure",
"type": "boolean"
},
"lastMeasure": {
"description": "last measure",
"type": "object"
}
}
}

0 comments on commit 1303bda

Please sign in to comment.