Skip to content

enumfield

Canonical path: o6.enumfield

enumfield

enumfield(
    value, *, name=None, description=None, displayName=None
)

Attach OPC UA metadata to an enum member.

Used as the assigned value of a member in an @o6.enumtype class body. Members declared as plain integers and members declared with this factory mix freely in one class.

@o6.enumtype(ns="plant")
class MachineState:
    IDLE = 0
    RUNNING = o6.enumfield(1, description="executing a program")

Parameters:

Name Type Description Default
value int

Numeric value of the member. Must be unique within the enumeration.

required
name Optional[str]

OPC UA member name, for a UA name that is not a valid Python identifier.

None
description Optional[str]

Description of the member in the EnumDefinition.

None
displayName Optional[str]

DisplayName of the member in the EnumDefinition.

None

Returns:

Type Description
int

A value that behaves as the member's int and carries the metadata until

int

the decorator consumes it.