Attribute not being accepted in Piston


I have a Piston that has previously worked on another Hubitat Hub that currently is not working on a different hub. The one part that is not working is where I grab the attribute lastCodeName and send an email when the keypad is disarmed that includes that attribute so you know who disarmed the keypad For some reason the attribute is not being picked up by WebCore. You can see from the last picture below that is it not recognizing it even though it does exist in the device. Any help would be appreciated:


I would check your spelling

You have spaces and extra [ in them.

at first pass when I fix these it works for me.


Yeah, I checked that already. Interesting case about WebCore is that it does not matter how many blank spaces you have as long as you have the {} and [] correct, which it is. I tested that by typing in another attribute of the Keypad, this time ‘battery’ and there is no red error code. Even when I add extra spaces as you can see below. The syntax is right. It is a direct copy from another hub in another home where it worked perfectly. Ugg…


Now I see now where I had the extra ‘[’ in the code. Though that is on another line, it is not the line that is causing WebCore to not think that ‘lastCodeName’ is not an attribute. Same problem still exists…


This is odd…just a test, try entering as an expression so you can place the attribute outside of the text
[Ring Alarm Keypad G2 : lastCodeName] " has opened the Golf Garage Door"


Interesting, have you tried copying the driver on the existing hub (where it’s working) to the new hub?


@fieldsjm Thanks for the suggestion. I really dont know how to add an expression to a piston. If you can give me a quick description of how to do it or an example how I can add it to this Piston I will give it a shot!

@eibyer good question as I am also questioning if it could be the device driver not working correctly. I am using Hubitat’s embedded driver for the Ring keypad 2 for both hub, so there should be no difference. Though it kind of seems like this could be the problem, it is not possible to check since their code is not available to view.


When adding a task there are multiple options for each field in the drop down…defaults to value but there is an option called expression
Expressions can get complicated but starting with the basics.
Text requires quotes, either single or double. Variables, attributes, and functions can be written without quotes.
In you case, start with the [device : attribute] followed by the message text in quotes.
[Ring Alarm Keypad G2 : lastCodeName] " has opened the Golf Garage Door"

You get immediate feedback as webcore evaluates the expression. I don’t have that device I get an obvious error. Hopefully, you do not.

Simple example with one of my own devices, you can clearly see what it evaluates to.


Are both hubs on same firmware?