$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.
|Name (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.
(from LB 2.0.2+)
|IP address (or hostname) of the Miniserver|
|0 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+)|
|http Web-Port of the Miniserver|
|0 or 1 - LoxBerry and plugins should use https instead of http (from LB 2.0.2+)|
|https Web-Port (from LB 2.0.2+)|
|Depending on |
|Miniserver user to login (URL encoded)|
|Passwort of the login user (URL encoded)|
|Miniserver user to login (not URL encoded)|
|Passwort of the login user (not URL encoded)|
|User specified note or link|
|Returns 1 if a Loxone CloudDNS connection is needed|
|The MAC address of the Miniserver used for CloudDNS|
|Use get_ftpport instead, to fetch the correct FTP port.|
|1 if this Miniserver should use encrypted REST calls (currently not used)|
|1 if the response from encrypted Miniserver REST requests should be encrypted (currently not used)|
For http/https requests, the
FullURI_RAW method is the most efficient way.
If the credentials directly are required, requesting them can be done in different ways:
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.
get_miniservers always returns the correct
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
Port fields. Therefore, the plugin does not need to handle CloudDNS Miniservers in a special way.
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.
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.