ph_getdeviceval PowerHome formula function
Description
Returns data associated with specific columns for a particular device.
Syntax
ph_getdeviceval ( type, id, parm)
Argument Description
type Integer. A numeric value equating to the type of device whose values are being retrieved. See usage below.
id String. The ID for the device you're retrieving.
parm String. The particular parameter you're retrieving the value of. See usage below.
Return value
Double. Returns the numeric value from the column specified in the parm parameter. - 1.0 is returned for invalid types. -2.0 is returned if there is an error retrieving the data from the database. -3.0 is returned if the parm parameter is invalid. -4.0 is returned if the type parameter is one that is currently reserved (0,2,4,6,21)
Usage
Use this function to retrieve specific values for a device directly from the PowerHome database without having to write SQL statements.
The type parameter specifies the device type and is a numeric value as defined below:
0 Reserved for X10 device types.  Not yet implemented.
2 Reserved for Digital Input/Output types.  Not yet implemented.
4 Reserved for Analog device types.  Not yet implemented.
5 Insteon device type
6 Reserved for Insteon Groups.  Not yet implemented.
20 UPB device type
21 Reserved for UPB links.  Not yet implemented.

The parm parameter is a string representing the database column you'd like returned.

Below are the allowed values for Insteon (type 5) device types:
commcnt
ackcnt
nakcnt
timeoutcnt
ttacnt
xcommcnt
xackcnt
xnakcnt
xtimeoutcnt
xttacnt
failedmatch
xfailedmatch
iengine
usexaldb
firmware
activeflag

Below are the allowed values for UPB (type 20) device types:
commcnt
ackcnt
nakcnt
avgss
firmware
Examples
The following examples demonstrate typical syntax/usage for this function.
ph_getdeviceval(5,"KITCHEN","commcnt")
The above example will return the total commcnt for Insteon device KITCHEN.