ph_getdevicestat PowerHome formula function
Description
This function retrieves an internally stored device status for the specified device. It does not cause PowerHome to query the device for its current status.
Syntax
ph_getdevicestat ( type, id, data, flags)
Argument Description
type Integer. The device type whose status you're trying to retrieve.  See Usage below.
id String. The ID of the device you're retrieving the status of.
data Integer. The specific piece of data you'd like to retrieve.  See Usage below.
flags Integer. This parm is currently unused and is reserved for future enhancements.  Use a 0 until this parm is implemented.
Return value
Return Info
Usage
Use this function to retrieve values concerning a device that is internally tracked by PowerHome.
The type argument must be a number from 0 to 6.  The meaning if each is detailed below:
0 X10
1Digital Input/Output
2 Analog
3 Insteon
4 Insteon group
5 UPB
6 UPB link

The data argument is a string that must be chosen from the list below:
0 Returns the stat_msg column which is the status message for the device as displayed on the Device Status screen
1 Returns the value1 from the view.  This will typically be the status of the device with 0 = unknown, 1 = off, 2 = on (in the case of X10).
2 Returns the value2. This will typically be the level for a device
3 Returns the value3. This will be string representation of value1 (status) of the device
4 Returns the lastchange column which is the datetime for when the status was last updated by PowerHome
5 Returns the stat_textcolor column. This is the numeric color value for the text of the status (this will match what is displayed on the Device Status screen)
6 Returns the stat_backcolor column. This is the numeric background color value for the status field
7 Returns the stat_graphic column.  This is the path and filename for the status graphic that is being displayed..
Examples
The following examples demonstrate typical syntax/usage for this function.
ph_getdevicestat(3,"KITCHEN",0,0)
This example will return the status message for KITCHEN which is an Insteon device.  The value returned during testing was "On"