Skip to content

Commit

Permalink
Merge pull request #643 from telefonicaid/fix/bad_mqtt_measure_progre…
Browse files Browse the repository at this point in the history
…s_as_multiple_measure_after_procesed_as_hex_string

check if procesedMesassure is an array of object, not just an array
  • Loading branch information
fgalan authored Mar 28, 2022
2 parents 7699387 + 3a739d9 commit e138f82
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Fix: bad mqtt measure is progressing as a multiple measure after be procesed as hex string (#642)
Fix: search device and group for a command using entity type when provided to proper match (iota-node-lib#1211)
Fix: replace git:// to https:// url for npm dependences
Upgrade NodeJS version from 12 to 14 in Dockerfile
Expand Down
3 changes: 2 additions & 1 deletion lib/commonBindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ function messageHandler(topic, message, protocol) {
for (let i = 0; i < parsedMessage.length; i++) {
commandHandler.updateCommand(apiKey, deviceId, device, parsedMessage[i]);
}
} else if (parsedMessage && typeof parsedMessage === 'object') {
} else if (parsedMessage && Array.isArray(parsedMessage) && parsedMessage.every((x) => typeof x === 'object')) {
// it must be an array of object
multipleMeasures(apiKey, deviceId, device, parsedMessage);
} else {
config.getLogger().error(
Expand Down

0 comments on commit e138f82

Please sign in to comment.