Skip to end of metadata
Go to start of metadata

$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.

NameName (not hostname!) of the Miniserver

These two fields return the full http/https root url to connect to the Miniserver, including encoded credentials, considering CloudDNS and the PreferHttps setting.

FullURI contains the credentials URI-encoded, FullURI_RAW holds the credentials in UTF8 (not encoded, including umlauts/special chars). Depending on your lib, use this or that.

http://<Admin>:<Pass>@<IPAddress>:<Port> or https://<Admin>:<Pass>@<IPAddress>:<PortHttps>   Without trailing slash.

(from LB 2.0.2+)

IPAddressIP address (or hostname) of the Miniserver
IPv6Format0 or 1: This is an indicator flag, if the above IPAddress is an IPv6 address (1) or an IPv4 format or hostname (0). This does not indicate if the receiver is IPv6 (a hostname also may be an IPv6 host), but only flags the format of the field. With IPv6, in some libraries it is required to put an IPv6 address in [ square brackets ] to be possible to add a port, e.g. for http requests. This flag can be used to know if square brackets should be added or not. (from LB 2.0.2+)
Porthttp Web-Port of the Miniserver
PreferHttps0 or 1 - LoxBerry and plugins should use https instead of http (from LB 2.0.2+)
PortHttpshttps Web-Port (from LB 2.0.2+)
TransportDepending on PreferHttps, the result is a string "http" or "https" (from LB 2.0.2+)
AdminMiniserver user to login (URL encoded)
PassPasswort of the login user (URL encoded)
CredentialsAdmin:Pass combination (URL encoded)
Admin_RAWMiniserver user to login (not URL encoded)
Pass_RAWPasswort of the login user (not URL encoded)
Credentials_RAWAdmin:Pass combination (not URL encoded)
NoteUser specified note or link
UseCloudDNSReturns 1 if a Loxone CloudDNS connection is needed
CloudURLThe MAC address of the Miniserver used for CloudDNS
CloudURLFTPPortUse get_ftpport instead, to fetch the correct FTP port.
SecureGateway1 if this Miniserver should use encrypted REST calls (currently not used)
EncryptResponse1 if the response from encrypted Miniserver REST requests should be encrypted (currently not used)

For http/https requests, the FullURI / FullURI_RAW method is the most efficient way.

If the credentials directly are required, requesting them 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.


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.";

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";
  • No labels