You can do this with conditional actions in Rule Machine. If [Lock Code is entered] Then [Update a variable or write to a local file]. A hub Variable will be the most useful for using with other RM rules.
Yeah, I was thinking Hub Variables might be the direction I have to go. I was hoping there was some wildcard or variable where I could just do something like %device_[device#]% %attribute_lastCodeName% or something cool and already baked in for this type of purpose.
I got it working perfectly using a hub variable. The nice thing about the variable is that I can use it not just for notification purposes but also a way to keep track of the last code entered that wasn't my code or my wife's code.
Token is used if a variable contains element - I have one variable with three elements delimited with colons, and then in another rule I extract the three string variables using “set variable/token #”, And then convert two of them to numbers.
It’s a little bit of a PIA but only had to be set up once, then in other rules I only need to set one variable instead of three.
So I'm trying to do something here and I think it may be similar to your usage.
I'm trying to make a variable that can store the last three code names in a variable with three elements. So at the moment I created a string variable with an initial value of "A;B;C". What I'm trying to do is store the last three codes entered, where the latest code is always the first, then the previous first token becomes the second, the previous second token becomes the third, and the previous third value is discarded.
However, when I try to "set variable" and select "token", it appears to work the other way only. I can pull a value from a token and apply it to another variable, but I can't seem to figure out how to take a device attribute and apply it to a token slot...
So I figured out how to do what I needed. I had to make a rule with tons of local variables to store the elements I needed separately, and then write them in one string to a global variable with semicolons to delimit the elements. Then I can extract the various elements from other rules using tokens. Worked perfectly. Thanks for your help!