You should be able to send an array of ID's e.g [23,24,25]As @marcus-j-davies has allowed mutli casting in his nodes.
Or if you wamt a delay set up a loop ( for, forech, etc) and use node.send() rather than return, and delay each output of the function node with a delay set to rate limit. Writing Functions : Node-RED
Or use a split node and split the array of id,s and use the split payload in the same function node, you can rate limit each split message.
Hi and thank you so much for your prompt reply.
Would you be able to expand on your responses with a brief outline of the requirements, i am fairly new to nodered.
And the function node that is left, use the following
/* Short hand for 'If its TurnOn = true else false' */
let Value = (msg.payload.directive === "TurnOn" ? true : false)
const Nodes = [3, 5, 7] /* Your Target Nodes */
const ValueID = {
"commandClass": 37, /* Binary Class */
"endpoint": 0, /* Target End point - */
"property": "targetValue" /* Property */
}
const Message = {
payload: {
cmd: {
api: 'VALUE',
method: 'setValue'
},
cmdProperties: {
nodeId: Nodes,
valueId: ValueID,
value: Value
}
}
}
return Message
Sending an array (collection of Node ID's) : [1,2,3,4,5]
The Device Node will attempt to send a single message to all target nodes, instead of 3 messages to the network.
This is not a Node RED thing its a Marcus is great thing
It uses multicast to achieve it.
The stipulation is, the Target nodes, must support the same class (and I think Security class), so its trial and error - although I think the underlining driver does a lot here to address that)
Also..
Where you see commandClassName, propertyName its just metadata, not a required property
An array in javascript, is just that... an array of "things" [Something, Something, Something, Something]
In the Device Node, it supports an array of Node IDs
Hi Marcus
May I take this opportunity to thank you for the basic and informative way you explained the solution. It works a treat there was no trial and error but it also taught me about arrays. Thank you for your input of Zwavejs.
As late father used to say "Every day is a school day"