Thanks, but just to confirm, Duncan:
-
If you want to use an local use, as well as for sharing (i.e., via Event), you can “declare” the Attribute name as a local variable with “
def reportASAP”, right? Are these actually the same storage object, or two distinct namespaces (i.e., a local variable, and an Attribute are not really interchangeable but can have overlapping names?) -
A SmartApp can read the latest value of an a Device’s Attribute (as set by an Event) in a variety of ways, including:
- State
device.currentState(attributeName)(returns an Attribute State Object, includes properties such as<state>.value, etc.). - Object
device.currentValue(attributeName)(returns the value of the Attribute in its datatype) - latest and range variations of State (
latestState,statesBetween(...)). - State
device.<attribute name>State(a magic property name) - Object
device.current<Uppercase attribute name> - maybe: The Attribute can be fished out of the Event object (ummm…
evt.name,evt.value, …)?
Any other obvious ones I’m missing? The above are all from Doc Reference page: https://graph.api.smartthings.com/ide/doc/device
Not saying @Mike_Maxwell is mistaken, but I’d like if @duncan could clarify my confusion:
Confirm or deny syntax, please: Mike mentions that an Attribute can be updated with an implied Device Command made up of the name of the Attribute; I’ve never tried that syntax: device.AttributeName(1).
Also, he says in the metadata{}, the datatype for Attribute is a List. Again, I’ve never seen list syntax needed or used: Attribute myNumber, "number" works fine, not Attribute myNumber, ["number"].
Thanks!!! ![]()