variabletype¶
Canonical path: o6.variabletype
variabletype
¶
variabletype(
*,
ns=None,
nodeId=None,
browseName=None,
displayName=None,
description=None,
writeMask=None,
userWriteMask=None,
rolePermissions=None,
accessRestrictions=0,
isAbstract=False,
dataType=None,
valueRank=None,
arrayDimensions=None,
value=None,
interfaces=None
)
Declare an OPC UA VariableType from a Python class.
The Python base class becomes the HasSubtype parent, so
class TemperatureType(ns0.vartypes.BaseDataVariableType) declares a
subtype of BaseDataVariableType. Annotated class attributes assigned with
a reference helper such as o6.hasProperty become
instance declarations of the type, and Optional[T] on the annotation makes
the child Optional rather than Mandatory.
Calling the decorated class afterwards either creates a live server node or
another declaration, depending on the server and parent arguments of the
call.
dataType, valueRank, and arrayDimensions are inherited from the
HasSubtype parent when omitted, because OPC UA requires a subtype's value
constraints to be equal to or narrower than its parent's. A root type with
no VariableType base falls back to BaseDataType and ValueRank.ANY.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ns
|
Optional[str]
|
Shortname of the declaring namespace. Inferred from |
None
|
nodeId
|
Optional[str]
|
NodeId of the VariableType node. Allocated in the declaring namespace when omitted. |
None
|
browseName
|
Optional[str]
|
BrowseName of the node. Defaults to the class name. |
None
|
displayName
|
Optional[str]
|
DisplayName of the node. Defaults to the BrowseName. |
None
|
description
|
Optional[str]
|
Description attribute. Defaults to the class docstring. |
None
|
writeMask
|
Optional[int]
|
WriteMask attribute of the node. |
None
|
userWriteMask
|
Optional[int]
|
UserWriteMask attribute of the node. |
None
|
rolePermissions
|
Optional[Mapping[Any, int]]
|
RolePermissions, as a mapping of role to
|
None
|
accessRestrictions
|
int
|
AccessRestrictions attribute of the node. |
0
|
isAbstract
|
bool
|
Declare the type abstract, so it cannot be instantiated. |
False
|
dataType
|
Any
|
DataType of the value: an |
None
|
valueRank
|
Optional[int]
|
ValueRank of the value, for example
|
None
|
arrayDimensions
|
Optional[list[int]]
|
ArrayDimensions of the value. |
None
|
value
|
Optional[Any]
|
Default value carried by the type node itself. |
None
|
interfaces
|
Optional[list[Any]]
|
OPC UA InterfaceTypes this type implements. They become
|
None
|
Raises:
| Type | Description |
|---|---|
TypeError
|
The decorated object is not a class, or an entry of
|