ScriptAutomationServer¶
- class ScriptAutomationServer.AutomationServer¶
- Bases: - object- Scripting functionality for the “CODESYS Automation Server Connector” plugin. An instance of this interface is injected into the default namespace under the name “cas”. - Note - Only available if the “CODESYS Automation Server Connector” Plugin and the “CODESYS Script Engine” packages are installed! - property credentials: CasCredentialsManager¶
- Gets the credentials manager to manage the stored server credentials. - Return type:
- CasCredentialsManager
- Returns:
- The credentials manager instance responsible to manage server credentials. 
 
 - property proxy_credentials: CasCredentialsManager¶
- Gets the credentials manager to manage the stored proxy credentials. - Return type:
- CasCredentialsManager
- Returns:
- The credentials manager instance responsible to manage proxy credentials. 
 - Note - This credentials are used when the connector tries to access the server and the operation system settings require using an http proxy which requires authentication. 
 - property options: CasOptionsManager¶
- Gets the CasOptionsManager to manage options and settings for the cas connector plugin. - Return type:
- CasOptionsManager
- Returns:
- The CasOptionsManager to manage options and settings for the cas connector plugin. 
 
 - property edge_gateway: CasEdgeGatewayManager¶
- Gets the CasEdgeGatewayManager to inspect and connect edge gateways. - Return type:
- CasEdgeGatewayManager
- Returns:
- The CasEdgeGatewayManager to inspect and connect edge gateways. 
 
 - connect_edge_to_server(gateway: str, server_url: str, name: str, description: str = '', proxy_url: Optional[str] = None, proxy_user: Optional[str] = None, proxy_password: Optional[str] = None)¶
- Connects the specified edge gateway to the automation server. May be called on a not-yet configured edge gateway with config mode enabled. - Parameters:
- gateway (str) – The IP address or DNS host name of the Edge Gateway. 
- server_url (str | Uri) – The server URL or hostname 
- name (str) – The url or hostname of the automation server the edge gateway should be connected to. 
- description (str) – Optional description of the gateway on the server. 
- proxy_url (str) – Proxy url if the edge gateway needs to connect through an explicit proxy to the server. 
- proxy_user (str) – Proxy user if the proxy at - proxy_urlneeds authentication.
- proxy_password (str) – Proxy password if the proxy at - proxy_urlneeds authentication.
 
 - Note - This is a simple convenience method, use - edge_gatewayfor more sophisticated operations.
 - replace_edge_gateway(gateway: str, server_url: str, edge_id: int, proxy_url: Optional[str] = None, proxy_user: Optional[str] = None, proxy_password: Optional[str] = None)¶
- Connects the specified edge gateway to the specified automation server, taking the role of an already existing gateway. Should be called on a not-yet configured edge gateway with config mode enabled. - Parameters:
- gateway (str) – The IP address or DNS host name of the Edge Gateway. 
- server_url (str | Uri) – The server URL or hostname 
- edge_id (int) – The numeric ID of the edge gateway on the server. 
- proxy_url (str) – Proxy url if the edge gateway needs to connect through an explicit proxy to the server. 
- proxy_user (str) – Proxy user if the proxy at - proxy_urlneeds authentication.
- proxy_password (str) – Proxy password if the proxy at - proxy_urlneeds authentication.
 
 - Note - This is a simple convenience method, use - edge_gatewayfor more sophisticated operations.
 - provide_encryption_password_for_checkout(encryption_password: str)¶
- Provide a password for project encryption to be used for the - checkoutmethod. If the project you want to check out is password encrypted, use this method to provide a password before checkout, to avoid interactive login dialogs.- Parameters:
- encryption_password (str) – The project encryption password, or - Noneto reset the stored credentials.
 - Note - Projects encrypted using certificates or dongles may still trigger dialogs if the correct certificate or dongle is not present. - Note - This operation requires the “Projects” Script Driver to be installed to work. 
 - checkout(server_url, project_id: int, commit_id: int, project_path: str, overwrite: bool = False) ScriptProject¶
- Checkout of a project from the server. - Parameters:
- server_url (str | Uri) – The server URL or hostname. 
- project_id (int) – The project ID of the project to check out. 
- commit_id (int) – The commit ID of the project commit to check out. 
- project_path (str) – The directory where to check out the project. 
- overwrite (bool) – If set to - True, overwrite existing objects and project files. (This parameter is optional, default is- False.)
 
- Return type:
- Returns:
- The created project. 
 - Note - This operation requires the “Projects” Script Driver to be installed to work. 
 - synchronize_gateways(server_url=None) list[tuple[str, dotNETs.Guid, int]]¶
- Synchronize the list of remote gateways. - Parameters:
- server_url (str | Uri) – The server we should synchronize to. If omitted, and the primary project is connected, this server is used. 
- Return type:
- list[tuple[str, Guid, int]] 
- Returns:
- A list of python tuples containing (gateway_name, gateway_guid, gateway_id), where the gateway_guid is the Guid you can pass to - ScriptDeviceObject.set_gateway_and_address(...), and the gateway_id is the id of the gateway on the server.
 
 - find_gateway_guid(server_url, gateway_id: int) Guid¶
- Finds the Gateway guid for a given server and id, if it is registered in the current CODESYS installation. - Parameters:
- server_url (str | Uri) – The server we want the gateway for. 
- gateway_id (int) – The ID of the gateway on the server (may be an edge gateway, or a normal gateway registered below the edge gateway). 
 
- Return type:
- Guid| None
- Returns:
- The gateway guid for - ScriptDeviceObject.set_gateway_and_address(...), or- Noneif the gateway is not found.
 - Note - You can use - synchronize_gateways(server_url)to synchronize the remote gateways available on a specific server.
 - calculate_plc_address(plc_id: int) str¶
- Returns the CODESYS address to use with - ScriptDeviceObject.set_gateway_and_address(...)for a given PLC id on the server.- Parameters:
- plc_id (int) – The PLC id on the server. 
- Return type:
- str 
- Returns:
- The CODESYS address to use with - ScriptDeviceObject.set_gateway_and_address(...).