ph_getzwavedata PowerHome formula function
Description
Retrieves specified data for a Z-Wave device defined within PowerHome from the internally stored JSON structure for all Z-Wave devices.
Syntax
ph_getzwavedata ( as_id, as_parm, ai_type )
Argument Description
as_id String. The ID of the Z-Wave device for which to retrieve values
as_parm String. Based upon the Z-Wave ID in the as_id parameter, this field will specify the final portion of the name so that a fully qualified JSON identifier can be constructed
ai_type Integer. The specific column of data you would to have returned from the JSON structure. Valid values are 0 thru 4. See Usage below
Return value
String. Returns the specified data for the Z-Wave device ID requested in the as_id parameter. 
Usage
Use this function to access Z-Wave device related data that is not normally available from within the standard PowerHome database structures.  

PowerHome maintains a JSON structure that contains the full device and status tree that is available within the current Z-Wave controller. This is a flattened JSON structure of name/value pairs and is accessed by a fully qualified JSON name. In the case of a Razberry controller, this would typically look like this:

devices.20.instances.0.commandClasses.114.data.serialNumber

Assuming a Z-Wave device defined within PowerHome on the Devices tab of the Zwave Explorer for Node ID 20, Instance 0, CC 114, PowerHome will build the JSON name up based solely upon the Z-Wave ID supplied in the as_id parameter. To retrieve the fully qualified JSON name above, you would need to set the as_parm parameter to "serialNumber". Everything prior to "serialNumber" will be automatically built for you by the function.

The ai_type parameter must have a value from 0 to 4. A value of 0 will return the string value associated with the JSON name. A value of 1 will return the data type of the string value. A value of 2 will return the Invalidate Time for the JSON name. A value of 3 will return the Update Time for the JSON name. A value of 4 will return the Other value associated with the JSON name.

In normal usage, this function and the ph_getzwavedataraw( ) function will probably never be called. These functions are for those who want to access the Z-Wave data within PowerHome at its lowest level

Examples
The following examples demonstrate typical syntax/usage for this function.
• ph_getzwavedata("FAMILYRM","serialNumber",0) - Assuming that the Z-Wave device ID FAMILYRM equates to Node ID 20, Instance 0, CC 114, the function will return the string value for the "devices.20.instances.0.commandClasses.114.data.serialNumber" JSON name