PerMalmberg / node-red-contrib-boolean-logic

Node-RED nodes to perform Boolean logic
MIT License
11 stars 7 forks source link

added two nodes for convenient change of topic for first and second input #3

Closed cinhcet closed 7 years ago

cinhcet commented 7 years ago

I often end up using your nodes in combination with lots of "change" or "function" nodes to alter the topics such that they can be understood as a first and second input. For convenience and cleaner flows, I created two extremely simple nodes that just change the topic to "A" and "B" directly without any configuration.

These aren't really necessary, but I believe that it leads to more transparent flows that are faster to create.

Two things I don't like in my pull request:

PerMalmberg commented 7 years ago

I like the idea of these nodes. Can you do something about the two things you don't like before I accept this PR?

cinhcet commented 7 years ago

size of the two new nodes: It would be cool to have them shorter, such that they are only the Letter "A" or "B" long.

I don't know if this is possible without changes in node-red itself? But I'm not sure. The link node is indeed shorter than other nodes.

With respect to the icon, have you an idea?

PerMalmberg commented 7 years ago

Iirc custom icons should be possible, but I'm not sure. Can be done at a later stage if wanted.

PerMalmberg commented 7 years ago

A thought - how about expanding your nodes to include A-Z, in a separate category ? It's only a matter of time until you'll need more than two inputs.

cinhcet commented 7 years ago

custom icons are possible, but I have no idea for a good icon :-)

A thought - how about expanding your nodes to include A-Z, in a separate category ? It's only a matter of time until you'll need more than two inputs.

One could argue that even the two nodes I provide are not necessary, since a change node or a function node could of course do the job. However, I think that the two input case (at least in my experience) is most common. Therefore, those two extra nodes are handy. If one would need more, I think it is better just to use normal change nodes? What do you think?

PerMalmberg commented 7 years ago

Personally I try to follow the DRY-principle (don't repeat yourself). Using a change node for input 3...n would mean repeating the same thing over and over.

Actually - what you should do is to create separate sub flows with a change node for the topics you need. That entirely removes the need for these hard coded nodes.

cinhcet commented 7 years ago

as you want. I am also fine without those hard coded nodes. Still think that they are useful and make the flows cleaner in the DRY sense. But I understand your point. Maybe its better without those nodes.