Basic question about variables... #123
Replies: 3 comments 4 replies
-
Did this instead.. I don't know if it impacts performance or if it just (more or less) gets converted to the above, when used by NR. |
Beta Was this translation helpful? Give feedback.
-
Hey, In a JS function node you can get the variables declared in your subflow as follow. let CommandClass = env.get("commandclass");
let Method = env.get("classMethod");
let Value = env.get("state");
let EP = parseInt(env.get("endpoint"));
let Node = parseInt(env.get("node"));
let Message = {
payload: {
mode: "CCAPI",
node: Node,
cc: CommandClass,
method: Method,
params: [Value], /* remember to keep params as an array */
endpoint: EP
}
}
return Message We have an awesome node being introduced soon (Known as the cmd-factory) - that will generate commands for you (given a set of inputs). |
Beta Was this translation helpful? Give feedback.
-
Oh, and in answer to you performance worry. My entire home security system - is run by, managed by and monitored by node red with various motion sensors, door sensors, keypad door entry devices etc etc - all runs without a hitch. |
Beta Was this translation helpful? Give feedback.
-
Im fiddling with a 'version 2' of my z-wave command subflow...
I've created a few variables but how on earth do i get these inside an object?
I have tried quite a few things from the node-red documentation, without much luck...
I know i'll have to translate 'on' to a Bool, etc. - but first I have to find out how to use the variables.
//argh-test
let Message = {
payload: {
mode: "CCAPI",
cc: "$commandtype",
method: "set",
params: $env('state'),
endpoint: "${endpoint}"
}
}
return Message
Beta Was this translation helpful? Give feedback.
All reactions