Owner's Manual (Complete)

Chapter 11 - Expressions
The Home Control Assistant
11
Format a date-time to a string:
s = _FormatTime(_now(), "$d-$b-$y $H:$M")
This would show as "15-Mar-03 09:08"
Numeric formatting functions
string = _FormatNum (number, # of decimal places)
Converts the number to a string with the given number of digits after the decimal point.
_FormatNumber(1.6764, 1) evaluates to "1.6"
string = _FormatInt (number, # digits, leading zeros?)
Converts the number to a string with no fractional part. If the third parameter is supplied and
if it evaluates to Yes, the string contains leading zeros.
_FormatInt(100.5,4) evaluates to " 100"
_FormatInt(100.5,4,1) evaluates to "0100"
string = _FormatPattern(number, string pattern)
This function is intended for users familiar with programming languages. The pattern uses the
same pattern characters as the C language printf function. Refer to C runtime documentation
or books on the programming language for full info. This documentation is not included here.
Device / Program / Group / Schedule functions
string = _status ("name")
Returns text that contains the status of the device, program, group, or controller. The text is
designed to be displayed to the user rather than operated on by subsequent Compute
expressions. What is returned depends upon the type of object. For example, a device returns
“ON, “OFF”, or “Dim xx%” where a program would show “Running” or “Not running”. In no
case is the device queries to fund out it’s true status – the status retuned is based upon HCA’s
internal state.
bool = _isOn ("name", send status?)
Attempts to look up the supplied name as a device, program, group, or controller. If it is On,
or is running if a program, then return Yes, otherwise No. If the second parameter is not
given, or evaluates to No, the status of the device is determined from the internal HCA state.
If the parameter is supplied and evaluates to Yes, and if the device supports status requests, a
status request is sent to the device and the response back determines the result.