Delete payload if value is a boolean, keep if a integer...possible?

Hello,

So I have a payload which returns true/false or numbers between 1-255, false is off, and true on…normal stuff.
But I am trying to send this payload to a hue integration in node-red, and goes fully bananas if it receives anything else than a value between 1-255. I am not able to change the payload, so that is out of the question.

There must be a way of deleting payload if it is a boolean�

Any of you clever people know what to do?

What did you try to get to that conclusion?

1 Like

There are LOTS of ways to accomplish both of those things. I’m a fan of function nodes that allow you to do nearly ANYTHING with payloads. But, you can also use Change and Switch nodes to accomplish the same thing.

For instance, to delete a payload if it is a boolean is simply:

Or you could use the traffic light node.
This will not change the payload just stop messages that you don’t want to pass.

[{"id":"bc399d7a.693ed","type":"traffic","z":"ebaa69a9.649708","name":"","property_allow":"payload","filter_allow":"\\d+","ignore_case_allow":false,"negate_allow":false,"send_allow":true,"property_stop":"payload","filter_stop":"\\w+","ignore_case_stop":false,"negate_stop":false,"send_stop":false,"default_start":false,"differ":false,"x":230,"y":520,"wires":[["777caa3e.1ec134"]]},{"id":"df9e7d98.0ad43","type":"inject","z":"ebaa69a9.649708","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"2","payloadType":"num","x":80,"y":520,"wires":[["bc399d7a.693ed"]]},{"id":"777caa3e.1ec134","type":"debug","z":"ebaa69a9.649708","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":390,"y":520,"wires":[]}]

This will now only allow numeric payloads.

2 Likes

arh, I was not explaining that very well :roll_eyes: I did mean I was not able to change payload coming from originator, was of course able to do it in node-red :sweat_smile: