ph_zwavesetcalc PowerHome formula function
Description
Allows the user to queue a "set" command for
a previously defined Z-Wave Device ID. The value is a calculated value as
opposed to a
"raw" value
Syntax
ph_zwavesetcalc ( as_id, as_value )
Argument | Description |
as_id | String. The PowerHome Z-Wave Device ID to
queue the "set" command for |
as_value | String. The calculated value you wish to set.
This value will be converted internally using the Calc to Raw formula for
the Device ID or a default value |
Return value
Integer. Returns 0 if the set command
is successfully queued. Returns -100 if Z-Wave ID in as_id does not exist.
Returns -1 if the controller associated with the Z-Wave ID is not found or
active. Returns -52, -53, -54 if the internal node ID, instance, and CC are out
of range. Returns -55 if the value (converted from as_value) is
out of range
Usage
Use this function to queue a "set"
command for a previously defined Z-Wave device using a calculated
value instead of a raw value like the ph_zwaveset( ) function. A calculated
value is put through several routines to determine the appropriate raw value
which is what a Z-Wave device actually understands. The first routine is to
determine a base default value. If "off" or "unlock" is passed as the
calculated value, the raw value will be 0. If "on" or "100" is passed as the
calc value then the raw value will be 99. If the calc value is "last" or "lock",
then the raw value is 255. If none of the previous defined calc values
are used, then the raw value is determined by converting the string based
calculated value into a numeric value. After this default value is determined,
the next routine is to run the Calc to Raw formula for the specified
device. If a Calc to Raw formula exists, then the previous determined
"default" value will be overwritten by
the formula
Examples
The following examples demonstrate typical syntax/usage for this function.
• ph_zwavesetcalc("KITCHENLIGHT","on")
- Returns 0 if the set command is successfully queue. Assuming that KITCHENLIGHT
is a previously defined device in the Z-Wave Explorer on the Devices tab
and equates to a CC of 38 without a Raw to Calc formula defined, this set
command will turn the light on at 100% brightness and would be equivalent
to ph_zwaveset("KITCHENLIGHT",99)