Feature request on reactions side.
-
Can you show me the valid values which the plugin accepts? (After all, they do exist and are transmitted by Lua, and I haven't yet encountered a value which MSR cannot send, so this makes me doubly curious.) Maybe I need to see more of your actual setup, if you don't mind?
FUN READ: https://kinkeadtech.com/control-ir-devices-with-z-wave/
-
@toggledbits can variable substitution be added to the "Code" field shown?
-
Variable substitution works in all action fields.
-
There you go!
-
yes, it just does not fire when putting the code into a variable.
-
Did you look in the MSR logs to see what was being sent? Did you look in the Vera log to see what was being received?
-
@tarkus said in Feature request on reactions side.:
yes, it just does not fire when putting the code into a variable.
Is MSR giving you any feedback in the Log and/or Status screen? I ask because perhaps you haven't used quotes around the hex code strings when defining your variables, for instance?
-
Have not gotten that far. Just was playing around with this, this morning before my workday started. Will dig into logs when I get a chance.
-
@librasun Ok the quotes did the trick! So I am assuming for
"code0","code1","code2", ... ,"code9"
I am assuming I am making 10 variables. i.e.
code0="0000 0067 0000 000D 0060 0018 0030 0018 0018 0018 0018 0018 0030 0018 0018 0018 0018 0018 0018 0018 0030 0018 0018 0018 0018 0018 0018 0018 0018 0422"
ect, ect....
-
@tarkus said in Feature request on reactions side.:
@librasun Ok the quotes did the trick! So I am assuming for
"code0","code1","code2", ... ,"code9"
I am assuming I am making 10 variables. i.e.
code0="0000 0067 0000 000D 0060 0018 0030 0018 0018 0018 0018 0018 0030 0018 0018 0018 0018 0018 0018 0018 0030 0018 0018 0018 0018 0018 0018 0018 0018 0422"
ect, ect....
Okay, not exactly. In my example, above, I had intended for you to paste all 10 codes, with quotes, directly into the array itself. I now see how cumbersome that would look, and not lend itself very well to editing.
So your approach of creating all 10 variables this way makes more sense... BUT you'd have to reference them in the array without quotes, as in:
buttonCodes = [code1, code2, code3, .... , code9]
and be sure to place this Expression definition after all 10 codeN declarations (this is just a best practice, not mandatory).
-
I also forgot to mention that I need to work a "." into the array
-
For starters,
you've put spaces between(edit: extra spaces should be OK)buttonCodes
and the[
which will not be interpreted correctly.
Look above at my original example: the syntax isbuttonCodes[index]
with no spaces.Secondly, your definition of
buttonCodes
itself shows just a long comma-separated list, which cannot work as is. To make it an array, it must start with[
and end with]
.Third, you reference
buttonCodes
in other variables, but named the expressionButtonCodes
which is different. These things must match exactly.Fourth, some of your
CharacterN
definitions result in alphanumeric characters which are NOT "just 0 through 9" -- like "x" or "." -- hence they CANNOT serve as theindex
for an array lookup. Another approach is needed (example: use an Object, per the suggestion below).This is proving more challenging than expected -- even turning everything into an Object would pose its own hazards at this point -- but getting the syntax right is way more than half the battle!
-
Also note that the data type of most of the index expressions is a string. Use
int()
to make sure it's a number: C1 =ButtonCodes[ int( Character1 ) ]
Also, it may be useful to break everything out this way while you're testing and figuring it out, but ultimately, you may want to combine them: C1 =
ButtonCodes[ int( substr( Channel, 0, 1 ) ) ]
-
The X's are just left over remnants of the lua process I was using. It was just padding and acted a indicator that the channel was at a end and stop the process. So channel 7.1 would come over as 7.1xx. I set 5 characters to accommodate a 5 digit channel i.e. 135.1 I will take a look at your suggestions.
-
One technique I use involves setting up to "parallel" arrays, an example of which I'll outline here without explicit reference to the problem at hand. I hope to share the mechanics of it without clutter...
value_I_have := getEntity(vera>source).parameter.i.want // result is "y" array_of_values := ["x","y","z"] // all possible input values listed in some order array_of_codes := ["0123","2345","3456"] // desired converted output values for "x", "y" and "z" buttonPush := array_of_codes[ indexOf (array_of_values, value_I_have) ]
Let that sink in a bit. In fact, if I were you @Tarkus , I'd mess around with abbreviated versions of this example in a throwaway Rule, just to get the feel for how each input affects the output.
-
@tarkus said in Feature request on reactions side.:
@librasun yes i do that often
That avoids the "trick" of trying to let
Character1
stand in as a numeric value (i.e. serving as anindex
to anarray
), since we now know that it may be alphabetical.
18/37