aiovantage.config_client
¶
Client for the Vantage Application Communication Interface (ACI) service.
The ACI service is an XML-based RPC service that Design Center uses to communicate with Vantage InFusion Controllers. There are a number of "interfaces" exposed, each with one or more "methods".
This service allows you to query the "configuration" of a Vantage system, for example fetching a list of all the objects, getting a backup of the Design Center XML, etc.
The service is exposed on port 2010 (SSL) by default, and on port 2001 (non-SSL) if this port has been opened by the firewall on the controller.
The service is discoverable via mDNS as _aci._tcp.local and/or
_secure_aci._tcp.local.
Classes:
-
ConfigClient–Client for the Vantage Application Communication Interface (ACI) service.
-
ConfigurationInterface–Wrapper for the
IConfigurationRPC interface. -
IntrospectionInterface–Wrapper for the
IIntrospectionRPC interface. -
LoginInterface–Wrapper for the
ILoginRPC interface.
ConfigClient
¶
ConfigClient(host: str, username: str | None = None, password: str | None = None, *, ssl: SSLContext | bool = True, ssl_context_factory: Callable[[], SSLContext] | None = None, port: int | None = None, conn_timeout: float = 30, read_timeout: float = 60)
Client for the Vantage Application Communication Interface (ACI) service.
Connections are created lazily when needed, and closed when the client is closed.
Parameters:
-
host(str) –The hostname or IP address of the Vantage controller.
-
username(str | None, default:None) –The username to use for authentication.
-
password(str | None, default:None) –The password to use for authentication.
-
ssl(SSLContext | bool, default:True) –The SSL context to use. True will use a default context, False will disable SSL.
-
ssl_context_factory(Callable[[], SSLContext] | None, default:None) –A factory function to use when creating default SSL contexts.
-
port(int | None, default:None) –The port to connect to.
-
conn_timeout(float, default:30) –The connection timeout in seconds.
-
read_timeout(float, default:60) –The read timeout in seconds.
Methods:
-
raw_request–Send a raw XML request to the ACI service and return the raw XML response.
-
rpc–Call a remote procedure on the ACI service.
-
close–Close the connection to the ACI service.
raw_request
async
¶
rpc
async
¶
rpc(interface_cls: type[Interface], method_cls: type[Method[Call, Return]], params: Call | None = None, *, master: int | None = None) -> Return
Call a remote procedure on the ACI service.
Parameters:
-
interface_cls(type[Interface]) –The interface class.
-
method_cls(type[Method[Call, Return]]) –The method class to call.
-
params(Call | None, default:None) –The parameters to pass to the method.
-
master(int | None, default:None) –The master number to address, defaults to the connected master.
Returns:
-
Return–The result of the method call.
ConfigurationInterface
¶
Wrapper for the IConfiguration RPC interface.
Methods:
-
open_filter–Open a filter for fetching Vantage objects.
-
get_filter_results–Get results from a filter handle previously opened with open_filter.
-
close_filter–Close a filter handle previously opened with open_filter.
-
get_object–Get one or more Vantage objects by their VIDs.
-
get_objects–Get Vantage objects, optionally filtered by a type and/or an XPath.
open_filter
async
staticmethod
¶
open_filter(client: ConfigClient, *object_types: str, xpath: str | None = None, master: int | None = None) -> int
Open a filter for fetching Vantage objects.
Parameters:
-
client(ConfigClient) –A config client instance
-
*object_types(str, default:()) –The type names of the objects to fetch, eg. "Area", "Load", "Keypad"
-
xpath(str | None, default:None) –An optional xpath to filter the results by, eg. "/Load", "/*[@VID='12']"
-
master(int | None, default:None) –The master number to address, defaults to the connected master
Returns:
-
int–The handle of the opened filter
get_filter_results
async
staticmethod
¶
get_filter_results(client: ConfigClient, h_filter: int, count: int = 50, whole_object: bool = True, master: int | None = None) -> list[WrappedObject]
Get results from a filter handle previously opened with open_filter.
Parameters:
-
client(ConfigClient) –A config client instance
-
h_filter(int) –The handle of the filter to fetch results for
-
count(int, default:50) –The maximum number of results to fetch
-
whole_object(bool, default:True) –Whether to fetch the whole object or a compact representation
-
master(int | None, default:None) –The master number the filter was opened on
Returns:
-
list[WrappedObject]–A list of Vantage objects
close_filter
async
staticmethod
¶
close_filter(client: ConfigClient, h_filter: int, master: int | None = None) -> bool
Close a filter handle previously opened with open_filter.
Parameters:
-
client(ConfigClient) –A config client instance
-
h_filter(int) –The handle of the filter to close
-
master(int | None, default:None) –The master number the filter was opened on
Returns:
-
bool–True if the filter was closed successfully, False otherwise
get_object
async
staticmethod
¶
get_object(client: ConfigClient, *vids: int) -> list[WrappedObject]
Get one or more Vantage objects by their VIDs.
Parameters:
-
client(ConfigClient) –A config client instance
-
*vids(int, default:()) –The VIDs of the objects to fetch
Returns:
-
list[WrappedObject]–A list of Vantage objects
get_objects
async
staticmethod
¶
get_objects(client: ConfigClient, *types: str, xpath: str | None = None, master: int | None = None, as_type: type[T]) -> AsyncIterator[T]
get_objects(client: ConfigClient, *types: str, xpath: str | None = None, master: int | None = None) -> AsyncIterator[Any]
get_objects(client: ConfigClient, *types: str, xpath: str | None = None, master: int | None = None, as_type: type[T] | None = None) -> AsyncIterator[T | Any]
Get Vantage objects, optionally filtered by a type and/or an XPath.
This is a convenience function that wraps the open_filter, get_filter_results and close_filter methods.
Parameters:
-
client(ConfigClient) –A config client instance
-
*types(str, default:()) –The type names of the objects to fetch, eg. "Area", "Load", "Keypad"
-
xpath(str | None, default:None) –An optional xpath to filter the results by, eg. "/Load", "/*[@VID='12']"
-
master(int | None, default:None) –The master number to fetch from, defaults to the connected master
-
as_type(type[T] | None, default:None) –The type to verify the objects as
Yields:
-
AsyncIterator[T | Any]–A stream of Vantage objects
IntrospectionInterface
¶
Wrapper for the IIntrospection RPC interface.
Methods:
-
get_interfaces–Get a list of all interfaces on the device.
-
get_sys_info–Get system information.
-
get_types–Get a list of all object types on the device.
-
get_version–Get the version of the device.
get_interfaces
async
staticmethod
¶
get_interfaces(client: ConfigClient) -> list[Interface]
Get a list of all interfaces on the device.
Parameters:
-
client(ConfigClient) –A config client instance
Returns:
-
list[Interface]–A list of interfaces.
get_sys_info
async
staticmethod
¶
get_sys_info(client: ConfigClient) -> SysInfo
Get system information.
Parameters:
-
client(ConfigClient) –A config client instance
Returns:
-
SysInfo–A system information object.
get_types
async
staticmethod
¶
get_types(client: ConfigClient) -> list[Type]
Get a list of all object types on the device.
Parameters:
-
client(ConfigClient) –A config client instance
Returns:
-
list[Type]–A list of object types.
get_version
async
staticmethod
¶
get_version(client: ConfigClient) -> Version
Get the version of the device.
Parameters:
-
client(ConfigClient) –A config client instance
Returns:
-
Version–A version information object.
LoginInterface
¶
Wrapper for the ILogin RPC interface.
Methods:
-
login–Login to the ACI service.
login
async
staticmethod
¶
login(client: ConfigClient, user: str, password: str) -> bool
Login to the ACI service.
Parameters:
-
client(ConfigClient) –A config client instance
-
user(str) –The username to login with
-
password(str) –The password to login with
Returns:
-
bool–True if the login was successful, False otherwise