Hello,
I'm creating some nodes for home automation. I had created some nodes for inputs/outputs control. They all have a configuration node.
RED.nodes.registerType('digital-output',{
category: 'upyHome',
color: '#a6bbcf',
icon: "inject.png",
align: "right",
defaults: {
name: { value: "" },
client: {value:"", type: "client", required: true },
domain: {value: "do"},
indentifier: {value: "", required: true}
},
The client is the configuration node.
I want to create a new node which is a group of this previous node, with an array of this set of properties.
I've seen something similar on the standard switch node
RED.nodes.registerType('switch', {
color: "#E2D96E",
category: 'function',
defaults: {
name: {value:""},
property: {value:"payload", required:true, validate: RED.validators.typedInput("propertyType")},
propertyType: { value:"msg" },
rules: {value:[{t:"eq", v:"", vt:"str"}]},
checkall: {value:"true", required:true},
repair: {value:false},
outputs: {value:1}
},
It appears that's rules is a property itself and note a set of properties, where we can specify a config with type.
It's also possible to multiply the configs and show / hide theses if not used but it will be painful and ugly.