Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V4.0.0-beta1: change to bool no longer working #4638

Closed
m-schaeffler opened this issue Apr 2, 2024 · 5 comments
Closed

V4.0.0-beta1: change to bool no longer working #4638

m-schaeffler opened this issue Apr 2, 2024 · 5 comments
Labels

Comments

@m-schaeffler
Copy link

m-schaeffler commented Apr 2, 2024

Current Behavior

If you try the example flow, the change node to bool converts ervery input to false!
2024-04-02 08_05_57-Node-RED _ Flow 2 – Mozilla Firefox

It should change on to true, off to false, and leave everything else as it is.
This was working with 3.1.8 and before fine; so it is a regression with 4.0.0-beta 1

Expected Behavior

You get this outputs:

Inject Debug 12 Debug 13
on true 1
off false 0
error error error

Steps To Reproduce

try this flow:
2024-04-02 08_00_42-Node-RED _ Flow 2 – Mozilla Firefox

Example flow

[{"id":"7b945e577024a009","type":"tab","label":"Flow 2","disabled":false,"info":"","env":[]},{"id":"ba5a22cdbcc2fcd7","type":"junction","z":"7b945e577024a009","x":340,"y":220,"wires":[["e7d937c74c016290","388cbdbfbc84b326","51821dcea7a40f23"]]},{"id":"e7d937c74c016290","type":"change","z":"7b945e577024a009","name":"to bool","rules":[{"t":"change","p":"payload","pt":"msg","from":"off","fromt":"str","to":"false","tot":"bool"},{"t":"change","p":"payload","pt":"msg","from":"on","fromt":"str","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":220,"wires":[["c6c155046e530222"]]},{"id":"b95a1eacb7e8dca5","type":"inject","z":"7b945e577024a009","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"on","payload":"on","payloadType":"str","x":230,"y":180,"wires":[["ba5a22cdbcc2fcd7"]]},{"id":"034b2af45fdfdef3","type":"inject","z":"7b945e577024a009","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"off","payload":"off","payloadType":"str","x":230,"y":220,"wires":[["ba5a22cdbcc2fcd7"]]},{"id":"e12db9eb3e02fbce","type":"inject","z":"7b945e577024a009","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"error","payload":"error","payloadType":"str","x":220,"y":260,"wires":[["ba5a22cdbcc2fcd7"]]},{"id":"388cbdbfbc84b326","type":"debug","z":"7b945e577024a009","name":"debug 11","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":440,"y":260,"wires":[]},{"id":"c6c155046e530222","type":"debug","z":"7b945e577024a009","name":"debug 12","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":620,"y":220,"wires":[]},{"id":"51821dcea7a40f23","type":"change","z":"7b945e577024a009","name":"to number","rules":[{"t":"change","p":"payload","pt":"msg","from":"off","fromt":"str","to":"0","tot":"num"},{"t":"change","p":"payload","pt":"msg","from":"on","fromt":"str","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":180,"wires":[["0a02112ec5e7e162"]]},{"id":"0a02112ec5e7e162","type":"debug","z":"7b945e577024a009","name":"debug 13","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":620,"y":180,"wires":[]}]

Environment

  • Node-RED version: 4.0.0-beta 1
  • Node.js version: 20.12.0-1nodesource1
  • npm version:
  • Platform/OS: RaspberryOs
  • Browser: Firefox
@knolleary
Copy link
Member

This change was made in response to #4372

At first read of this and the other issue, it sounds like two different desired behaviours - one saying it should always result in a boolean result, one saying it should only set a boolean in some circumstances.

Will look at the finer details to see if there's a subtly in behaviour we're missing - possibly the fix for the other issue is being too strict.

@colinl
Copy link
Contributor

colinl commented Apr 2, 2024

This change was made in response to #4372

At first read of this and the other issue, it sounds like two different desired behaviours - one saying it should always result in a boolean result, one saying it should only set a boolean in some circumstances.

I don't follow the logic of that. I don't see how the requirements conflict. In fact it seems that #4372 isn't fixed. I will comment there.

@knolleary
Copy link
Member

@colinl agreed - having dug into it a bit more, there is just a bug here to squash

@knolleary
Copy link
Member

Fixed via #4639

@m-schaeffler
Copy link
Author

fix is working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants