Zum Ende der Metadaten springen
Zum Anfang der Metadaten

%response = mshttp_send($msno, %InputsAndValues);

 

Sends a value to a Loxone Miniserver input, or sends multiple values to multiple inputs.

You should prefer the function LoxBerry::IO::mshttp_send_mem to take care for the Miniserver.

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 send data to inputs. It can be used for a single value, and 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 value

ParameterRequiredBeschreibung
$msnoxNumber of the Miniserver


$inputxThe name of the Miniserver input. The parameter must not be URL-encoded.
$valuexThe value to send. The parameter must not be URL-encoded.

Multiple values

ParameterRequiredBeschreibung
$msnoxNumber of the Miniserver


%InputWithValuesxA hash with input and value pairs. The parameters must not be URL-encoded.


Return value

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

On a multiple value call, the function returns a hash with the input keys. If the value of an input key has a value, it was successful. If the input key is undef, it was an error.


Usage

Single value

use LoxBerry::IO;

my $response = mshttp_send(1, "Light_Livingroom", "On");
if (! $response) {
	print STDERR "Error sending to Miniserver";
} else {
	print STDERR "Sent ok.";
}

The return code is defined to be undef, if the call was unsuccessful.

If the code is not undef, it was successful.

Multiple values

use LoxBerry::IO;

my %data_to_send;
$data_to_send{'Light_Livingroom'} = "On";
$data_to_send{'Light_Bath'} = "Off";
my %response = mshttp_send(1, %data_to_send);
if (! $response{'Light_Livingroom'}) {
	print STDERR "Error switching Livingroom";
} 
if (! $response{'Light_Bath'}) {
	print STDERR "Error switching Bath";
} 

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


  • Keine Stichwörter