Python Core API Set Operations¶
Blocking set functions¶
These functions return only once the device has received the set value. If the set operation fails, an exception is raised.
Note
syncSetInt
, syncSetDouble
and syncSetString
do the same as setInt
, setDouble
and setString
, but they also return the value of the node after the set operation. This can sometimes differ from the requested value due to rounding or clipping.
set(items_or_path, value=None)
¶
Overloaded function.
-
set(self, items: _MultipleNodeItems)
Set multiple nodes.
items
is a list of path/value pairs.A transaction is used to optimize the data transfer.
-
set(self, path: str, value: Any)
Set a single node value.
path
is the node path andvalue
the value to set.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
items_or_path |
Union[Union[List[Tuple[str, Any]], Tuple[Tuple[str, Any]]], str]
|
A list of path/value pairs or the node path string. |
required |
value |
Optional[Any]
|
The value to set in case of a single node set (items is the node path). |
None
|
setByte(path, value)
¶
setComplex(path, value)
¶
setDouble(path, value)
¶
setInt(path, value)
¶
setString(path, value)
¶
setVector(path, value)
¶
Set the value for a specified vector node.
The command is different from the other set commands and is Optimized for vector transfer. It blocks until the device itself has acknowledged the complete vector data set.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
Path string of the node. |
required |
value |
Union[ndarray, List[Union[int, float, complex]], Tuple[Union[int, float, complex], ...], str]
|
Vector ((u)int8, (u)int16, (u)int32, (u)int64, float, double) or string to write. |
required |
Async set functions¶
These functions return immediately. No exception is ever raised, even if the set operation fails.
asyncSetInt(path, value)
¶
Asynchronously set the value as integer for a specified node.
Asynchronously means that the command is nonblocking and does not wait for the data server acknowledgement.
Warning
This command never reports any error.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
Path string of the node. |
required |
value |
int
|
Value of the node. |
required |
asyncSetDouble(path, value)
¶
Asynchronously set the value as double for a specified node.
Asynchronously means that the command is nonblocking and does not wait for the data server acknowledgement.
Warning
This command never reports any error.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
Path string of the node. |
required |
value |
float
|
Value of the node. |
required |
asyncSetString(path, value)
¶
Asynchronously set the value as string for a specified node.
Asynchronously means that the command is nonblocking and does not wait for the data server acknowledgement.
Warning
This command never reports any error.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
Path string of the node. |
required |
value |
str
|
Value of the node. |
required |
Legacy blocking set functions¶
These functions block until the device has acknowledged the set value. Since version 25.04, set
, setInt
, setDouble
, setComplex
, setString
and setByte
have the same behavior so these functions are now superfluous and kept only for backward compatibility.
syncSetInt(path, value)
¶
Synchronously set the value as integer for a specified node.
Synchronously means that the command is blocking until the device has acknowledged the set request.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
Path string of the node. |
required |
value |
int
|
Value of the node. |
required |
Returns:
Type | Description |
---|---|
int
|
Acknowledged value by the device. |
syncSetDouble(path, value)
¶
Synchronously set the value as double for a specified node.
Synchronously means that the command is blocking until the device has acknowledged the set request.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
Path string of the node. |
required |
value |
float
|
Value of the node. |
required |
Returns:
Type | Description |
---|---|
float
|
Acknowledged value by the device. |
syncSetString(path, value)
¶
Synchronously set the value as string for a specified node.
Synchronously means that the command is blocking until the device has acknowledged the set request.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
Path string of the node. |
required |
value |
str
|
Value of the node. |
required |
Returns:
Type | Description |
---|---|
str
|
Acknowledged value by the device. |