Zum Ende der Metadaten springen
Zum Anfang der Metadaten

$miniservers = LBSystem::get_miniservers();

 This function returns an two dimension array of LoxBerry's configured Miniservers.Using defined keywords, you can access Miniserver connection data and credentials.


 

Hash-VariableInhalt
NameName (not hostname!) of the Miniservers
IPAddressIP address
PortWeb port
AdminMiniserver's administrative user (URL encoded)
PassPasswort of the administrative user (URL encoded)
Credentialsuser:pass combination (URL encoded)
Admin_RAWMiniserver's administrative user (not URL encoded)
Pass_RAWPasswort of the administrative user (not URL encoded)
Credentials_RAWuser:pass combination (not URL encoded)
NoteUser specified note or link
UseCloudDNSReturns 1 if a Loxone CloudDNS connection is needed
CloudURLThe MAC address used for CloudDNS
CloudURLFTPPortUse get_ftpport instead to fetch the correct FTP port.
SecureGateway1 if this Miniserver should use encrypted REST calls
EncryptResponse1 if the response from encrypted Miniserver REST requests should be encrypted

Requesting the credentials can be done in different ways: Admin, Pass or the combined Credentials, or the non-URL-encoded variants in RAW.

Web requests should always use the URL encoded style as they can directly been passed to the Miniserver.

For FTP connection, you need to use the RAW variants as FTP needs plain strings.

RAW credentials and Miniserver webservice

If you wrongly use the RAW credentials to connect to the webservice of the Miniserver, your plugin, your users and you will get mental problems about special characters in users and/or passwords.

Loxone CloudDNS

get_miniservers always returns the correct IPAddress and Port, independent from a local or CloudDNS configuration. If the user configures CloudDNS, LoxBerry queries IP and port and returns the external address in the IPAddress and Port fields. Therefore, the plugin does not need to handle CloudDNS Miniservers in a special way.

Usage

Example
require_once "loxberry_system.php";

$ms = LBSystem::get_miniservers();
if (!is_array($ms)) 
{
	echo "No Miniservers configured.";
}
 
echo "My Miniserver 1 {$ms[1]['Name']} uses the ip {$ms[1]['IPAddress']}.";
echo "My Miniserver 2 " . $ms[2]['Name'] . " uses the ip " . $ms[1]['IPAddress'] . ".";
 
foreach ($ms as $miniserver) 
{
	echo "This Miniserver is named {$miniserver['Name']} and uses ip {$miniserver['IPAddress']}.";
}

Check if entries are available

To reduce misbehaviour of your plugin, you should double-check, if get_miniservers returns values, or a specific Miniserver entry is available.

Check, if any Miniservers are configured

This can be helpful on select dropdowns or scripts. 

If your plugin requests at least one configured Miniserver, the check can be useful to signal the user to properly configure his Miniserver in the web interface.


$ms = LBSystem::get_miniservers();
if (! is_array($ms)) {
	echo "No Miniservers configured.";
	exit(1);
}

Check if a specific Miniserver is available

This check for a specific Miniserver (number) is especially interesting, if the user has selected a Miniserver in the UI and, later, your script needs to check if that Miniserver is still available.


$ms = LBSystem::get_miniservers();
if (!isset($ms[1])) {
	echo "Miniserver 1 not available";
	exit(1);
}
  • Keine Stichwörter