An object
specifying FHEM- and request-related settings.
You can pass any logger instance as long as it provides the methods log(level, ...args)
, debug
, info
, warn
and error
.
Time in millis after which to discard a failed request.
If this has been set to a positive value and a request fails, then, if the respective error code has a positive
retry interval, it will be reissued after the specified time until it succeeds or expirationPeriod
is exceeded.
If set to 0 (the default), a failed request will be discarded immediately and an Error
will be thrown.
See property Options.retryIntervals
of options
param of FhemClient.constructor
.
Request FHEMWEB to call a registered module function. This method corresponds to FHEM's Perl function 'CallFn'.
The name of the device to call the function for.
The name of the function as used to register it in the module hash.
Whether the ref to the instance hash of the device should be passed to the function as first argument. Defaults to false
.
Whether the function returns a hash that should be transformed to a Map. Defaults to false
.
If the function returns a hash (literal, no ref), which is just an even-sized list, you must indicate this.
Failing to do so will give you an array of key/value pairs.
On the other hand, if you provide true for this and the function returns an odd-sized list, the Promise
will be rejected.
This parameter is meaningless if the function returns a scalar.
The arguments to be passed to the function.
If an argument is undefined
, the function will get Perl's 'undef' for that argument.
If an argument is true
or false
, the function will get 1 or "", respectively.
A Promise
that will be resolved with the result on success or rejected with one of the following errors.
If the function cannot be found in the module hash or returns 'undef', the result will be undefined
.
If the function returns a scalar or a list, the result will be a value or an array, respectively.
Furthermore, if the list is even-sized and functionReturnsHash === true
, the result will be a Map.
In either case, numbers will be returned as numbers, not as strings.
Request FHEMWEB to execute a FHEM command.
The FHEM command to execute
A Promise
that will be resolved with the result in its actual data type on success or rejected with one of the following errors.
Request FHEMWEB to execute Perl code.
A string containing valid Perl code. Be sure to use ';;' to separate multiple statements.
A Promise
that will be resolved with the result in its actual data type on success or rejected with one of the following errors.
Generated using TypeDoc
Creates and initialises an instance of FhemClient.
Error
with code 'EFHEMCL_INVLURL' in caseoptions.url
is not a valid url string.