ph_ctlrcmd PowerHome formula function
Description
Sends a raw command to a PowerHome controller using the internal communication structure.
Syntax
ph_ctlrcmd ( as_ctlrid, ai_command, ai_parm1, al_parm2, as_parm3, as_parm4 )
ph_ctlrcmd ( ai_type, as_ctlrid, ai_command, ai_parm1, al_parm2, as_parm3, as_parm4 )
Argument | Description |
ai_type | Integer (Optional). Determines the type of data returned
from the function. Valid values are 0 and 1. If this parameter is omitted,
internally a value of 0 will be used |
as_ctlrid | String. The ID of the controller to send commands to |
ai_command | Integer. The command number to send |
ai_parm1 | Integer. Parameter 1 to pass to controller |
al_parm2 | Long. Parameter 2 to pass to controller |
as_parm3 | String. Parameter 3 to pass to controller |
as_parm4 | String. Parameter 4 to pass to controller |
Return value
String. Returns the output from the
function depending upon the value passed in the ai_type parameter.
If ai_type = 0, the function will return the 4 return values (i_ret1, l_ret2, s_ret3, and s_ret4) from the communication structure. These values are separated with ~255 escape characters.
If ai_type = 1, the function will return the success/failure value of the function, the
4 return values (i_ret1, l_ret2, s_ret3, and s_ret4), and the 4
parameter values (i_parm1, l_parm2, s_parm3, and s_parm4). Each value is separated with
a ~255 character. The parameter values would normally just contain the data
that was passed when the function was called but certain command will also
populate return vaues in these fields< /p >< /p >< /p >< /p >
Usage
Use this function to pass raw commands to a
connected PowerHome controller. Usually a command will be sent to a controller
using an already existing standard function but some controllers provided
"extra" commands that are not handled by the standard functions. If a controller
supports raw commands, details of the parameters will be documented under the
specific controller such as the "Elk
M1 Gold"
Examples
The following examples demonstrate typical syntax/usage for this function.
• ph_ctlrcmd(1,"ELK",350,0,0,"","") -
Assuming that the controller in this example is an Elk M1 Gold, this command
returns the zone definition. A typical example return will look like:
"0ÿ0ÿ0ÿ4455433333333333111333333333330000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ÿÿ0ÿ0ÿÿ"
The first 0 signifies that the function was successful (a value of 0 is success, any other value is a failure). The "ÿ" characters seen throughout is the ASCII representation of the ~255 characters. The i_ret1 and l_ret2 values are both 0 with the zone definition contained in the s_ret3 parameter. The remaining return values are all either 0 or empty ""