Zum Ende der Metadaten springen
Zum Anfang der Metadaten

(string/array) $response = mshttp_get($msno, (string/array) $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.5. Set your LB_MINIMUM version in your plugin.cfg accordingly.

The function uses the Miniserver HTTP REST webservice to query data from Loxone 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 LBSystem::get_miniservers, starting with 1).

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

Parameter

Single object

ParameterRequiredBeschreibung
$msnoxNumber of the Miniserver


$inputxThe name of the Miniserver object as string. The parameter must not be URL-encoded.

Multiple values

ParameterRequiredBeschreibung
$msnoxNumber of the Miniserver


$inputsxAn keyless array with input names

Return value

On a single value call, the function returns a string of the queried value on success, or null on error.

On a multiple value call, the function returns an array with the input names as keys. The return values are stored in the keys, or are null, if an error occured.

See the examples for more clearance.

Usage

Single value

require_once "loxberry_io.php";

$response = mshttp_get(1, "Light Livingroom");
if (empty($response)) {
	echo "Error retrieving from Miniserver";
} else {
	echo "Value is $response.";
}

Multiple objects as array

require_once "loxberry_io.php";

$response = mshttp_get(1, [ "Light_Livingroom", "Light_Bath", "Light_Stairway" ] );
foreach ($response as $input => $value) {
	if(!empty($value)) {
		echo "Input $input has value " . $value;
	}
}

Every value of a key has the queried value on success, or is null on error.


  • Keine Stichwörter