OPC UA Connector Schemas#
OPC UA Connector Schemas
This module provides Pydantic models to define and validate configuration schemas for OPC UA devices within OpenFactory.
Key Models:#
OPCUAServerConfig: Configuration for the OPC UA server, including the endpoint URI and namespace URI.
OPCUADeviceConfig: Configuration for a device on the OPC UA server. Allows specifying the device either by a hierarchical path or a NodeId. Variables and methods are optional.
OPCUAConnectorSchema: Wrapper schema that encapsulates the server and device configurations.
Validation Features:#
Ensures that either ‘path’ or ‘node_id’ is provided for a device.
Variables and methods are optional, providing flexibility for different server setups.
Forbids unknown fields to ensure strict schema conformance.
YAML Example:#
type: opcua
server:
uri: opc.tcp://127.0.0.1:4840/freeopcua/server/
namespace_uri: http://examples.openfactory.local/opcua
device:
path: Sensors/TemperatureSensor_1
variables:
temp: Temperature
hum: Humidity
methods:
calibrate: Calibrate
See also
The runtime class of the class OPCUAConnectorSchema schema is openfactory.connectors.opcua.opcua_connector.OPCUAConnector.
- class openfactory.schemas.connectors.opcua.OPCUAConnectorSchema(**data)[source]#
Bases:
BaseModelOPC UA Connector schema wrapping the server and device configuration.
The type field is a discriminator for Pydantic to select this schema.
See also
The runtime class of the class OPCUAConnectorSchema schema is
openfactory.connectors.opcua.opcua_connector.OPCUAConnector.-
device:
OPCUADeviceConfig#
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
server:
OPCUAServerConfig#
-
device:
- class openfactory.schemas.connectors.opcua.OPCUADeviceConfig(**data)[source]#
Bases:
BaseModelOPC UA Device configuration.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].