diff --git a/package.json b/package.json index 8a0966d..ff134f5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-red-contrib-iiot-opcua", - "version": "4.1.1", + "version": "4.1.2", "description": "An Industrial IoT OPC UA toolbox contribution package for Node-RED based on node-opcua.", "repository": { "type": "git", diff --git a/src/core/opcua-iiot-core.ts b/src/core/opcua-iiot-core.ts index 6bdd197..b720a4b 100644 --- a/src/core/opcua-iiot-core.ts +++ b/src/core/opcua-iiot-core.ts @@ -656,7 +656,7 @@ export function normalizeMessage(msg: WriteMessage) { if (!isNotDefined(writeValues)) { return addressSpaceValues.map((item, index) => { - return {...item, value: writeValues[index] || ''} + return {...item, value: _.isUndefined(writeValues[index]) ? null : writeValues[index]} }) } else return addressSpaceValues.map((item, index) => { diff --git a/test/e2e/opcua-iiot-flex-server.test.js b/test/e2e/opcua-iiot-flex-server.test.js index 06e7992..cfaf396 100644 --- a/test/e2e/opcua-iiot-flex-server.test.js +++ b/test/e2e/opcua-iiot-flex-server.test.js @@ -91,6 +91,8 @@ describe("OPC UA Flex Server Node E2E testing", () => { expect(msg.payload.value[0].statusCode).toBeDefined() expect(msg.payload.value[0].statusCode.value).toBe(0) expect(msg.payload.value[0].value?.value).toBeDefined() + expect(msg.payload.value[0].value?.value).toBe(0) + expect(msg.payload.value[0].value?.dataType).toBe("Double") expect(msg.payload.injectType).toBe("read") done() })