zwave-js / node-red-contrib-zwave-js

The most powerful, high performing and highly polished Z-Wave node for Node-RED based on Z-Wave JS. If you want a fully featured Z-Wave framework in your Node-RED instance, you have found it.
MIT License
47 stars 6 forks source link

[Feature]: Ability to generate messages using a factory node #113

Closed marcus-j-davies closed 3 years ago

marcus-j-davies commented 3 years ago

What is your idea?

@lurendrejer

If you ever consider creating some sort of function node, where one can select commands (multi, switch, whatever)

@crxporter, As also discussed in discord

Example of its existence.

image

crxporter commented 3 years ago

110 related. Kind of.

Oh. Does related not work the same for discussions? It didn't pop up over there that we are here...

marcus-j-davies commented 3 years ago

Working Progress.

image

crxporter commented 3 years ago

Suggestion... fields for node and params similar to the NR official inject node?

what if my new brightness to set is at msg.hap.allChars.Brightness ... I would like to put that in. The input could come direct from NRCHKB.

Also, if "node" input could be the node name, that would really put a smile on my face... since my topics are already node names.

marcus-j-davies commented 3 years ago

Params and / or node can be taken from a msg part Params will expect an array object (either strongly typed) or taken from a msg part

marcus-j-davies commented 3 years ago

so in your case.

you set params to something like msg.payload.paramaters where parameters will be set prior like this msg.payload.paramaters = [msg.hap.allChars.Brightness]

or Evan msg.payload = [msg.hap.allChars.Brightness] where the Params path is set to msg.payload

then send your msg to this node

remember that params are an array - not a single object, so the Params box is asking what msg path your parameters array is in

crxporter commented 3 years ago

Well I just had a beautiful message all typed out on my phone here with an example json input and whatever... then it disappeared.

Apart from whether my topic can be a node name (for easy code readability instead of abstract node number) you answered my question and this looks awesome.

marcus-j-davies commented 3 years ago

the demo above is nothing more than a doodle. the paths to get the value can be any MSG part

crxporter commented 3 years ago

For anyone wanting to use this, it's available now. Some more instructions linked below.

https://github.com/zwave-js/node-red-contrib-zwave-js/wiki/Command-Factory

Instructions are still a work in progress. Feel free to open a new issue or discussion with more questions.