LoxBerry::IO::mshttp_get

$/%response = mshttp_get($msno, $/@Inputs);

Requests values from one or multiple Loxone inputs/blocks/outputs via HTTP REST.

LoxBerry Compatibility

This feature first is available with LoxBerry 1.2.4. Set your LB_MINIMUM version in your plugin.cfg accordingly.

The function uses the Miniserver HTTP REST webservice to query data from Config objects. It can be used for a single value or for multiple values. 

The first parameter is the Miniserver number (numbers are equal to LoxBerry::System::get_miniservers, starting with 1).

For a single value, and multiple values, use the following syntax:

Parameter

Single object

ParameterRequiredBeschreibung
$msno x Number of the Miniserver
$input x The name of the Miniserver object. The parameter must not be URL-encoded.

Multiple values

ParameterRequiredBeschreibung
$msno x Number of the Miniserver
@inputs x An array with input names

Return value

On a single value call, the function returns the queried value on success, or undef on error.

On a multiple value call, the function returns a hash with the object keys. The return values are stored in the obect keys, or are undef, if an error occured.

See the examples for more clearance.

Usage

Single value

use LoxBerry::IO;
my $response = LoxBerry::IO::mshttp_get(1, "Light_Livingroom");
if (! $response) {
    print STDERR "Error retrieving from Miniserver";
} else {
    print STDERR "Value is $response.";
}

Multiple objects as string list

use LoxBerry::IO;
 
my %response = LoxBerry::IO::mshttp_get(1, "Light_Livingroom", "Light_Bath", "Light_Stairway");
foreach my $resp (keys %response) {
    print STDERR "Object $resp has value " . $response{$resp};
}

Multiple values from array

use LoxBerry::IO;
 
my @data_to_query = ('Light_Livingroom', 'Light_Bath', 'Light_Stairway');
 
my %response = LoxBerry::IO::mshttp_get(1, @data_to_query);
foreach my $resp (keys %response) {
    print STDERR "Object $resp has value " . $response{$resp};
}

Every hash key of the returning hash has the queried value on success, or is undef on error.