Hi,
Since you don't have shared your code, I will try to explain in short how the switch node manages its rules on the config screen:
- When the node is registered in Node-RED, the 'rules' property is declared. This is an array of rules, which gets one rule by default:
RED.nodes.registerType('switch', { ... defaults: { ... rules: {value:[{t:"eq", v:"", vt:"str"}]}, ... },
- When the config screen is opened afterwards, all the rules in the array will be displayed on the screen:
oneditprepare: function() { ... for (var i=0;i<this.rules.length;i++) { var rule = this.rules[i]; $("#node-input-rule-container").editableList('addItem',{r:rule,i:i}); } },
- When the config screen is closed (with the 'done' button), the rules on the config screen need to be copied to the rules array:
oneditsave: function() { var rules = $("#node-input-rule-container").editableList('items'); var node = this; node.rules = []; rules.each(function(i) { ... node.rules.push(r); }); },
This way the 'rules' field always contains the correct rule set. So when the rules are not displayed, this means you don't show the rules array items on your screen OR you don't store the screen items in your rules array...
It is not easy to create such a node for the first time...
Good luck with it !
Bart