BiancoRoyal / node-red-contrib-iiot-opcua

deprecated - very new developed by PLUS for Node-RED - https://plus4nodered.com
https://www.npmjs.com/package/node-red-contrib-iiot-opcua
BSD 3-Clause "New" or "Revised" License
34 stars 8 forks source link

Writing '0' as string to a Boolean node sets it to true #108

Closed mm-dlwe closed 4 years ago

mm-dlwe commented 5 years ago

I'm submitting a ... (check one with "x")

Problem

Information

Current behaviour When writing a '0' as string to a Boolean node the value is set to true instead of false. The test 'should build new variant Boolean' in opcua-iiot-core.test.js looks like using 1 or 0 should actually be supported. But the test checks for '1' only and it is '0' that does not work.

A fix would probably be to change the condition in opcua-iiot-core.js at line 243 from if(value && value !== 'false') to if(value && value !== 'false' && value !== '0')

Expected behaviour Using '0' should be interpreted as false.

Minimal reproduction of the problem with instructions

  1. Setup a flow and try to write a boolean using a '0' string (see the attached demo flow)

Minimal Demo Flow flows-boolean.txt

Your Environment

Please tell us about your environment:

biancode commented 5 years ago

There was a reason, why I did not check for '0' to be used as a false ... I'll check it.

biancode commented 4 years ago

fixed since prerelease 3.11.1-4