I'm developing a new UI node that can be configured to a.o. add N LEDS on top of an image. In the following example I add 3 LEDs, each with a different color:
Which results in something like this:
Now I want to control the color of those LEDs via input messages from the Node-RED flow. But not sure what the best way is to accomplish this.
- Should I add a field in the config screen for every widget, where the user can enter a unique name (which I have to validate). Or should I generate an ascending index myself (and show it readonly). Or should I add a Or something else.
- The input message should contain both a LED identifier and a LED color. Should identfier be the
msg.topicand the color be the
msg.payload(which e.g. can be configured via two TypedInputs fields), or should both be in the payload, or something else.
- Suppose the user wants to change the status of all 3 LEDS. Should this be possible with a single input message (then I cannot use a topic I assume), or should I oblige him to send 3 separate input messages ...
I got in the past some great feedback from @DeanC (about another node), about avoiding people having to add tons of extra nodes (like Change node) in their flows to compose the input message. So that is really something that I would like to pay attention to this time...
P.S. This discussion is not about 'why' I want to add LEDs. If some users really hate LEDs, they can just ignore them. Case closed in advance