MCPcopy Create free account
hub / github.com/FreeOpcUa/python-opcua / set_attributes

Method set_attributes

opcua/client/ua_client.py:661–677  ·  view source on GitHub ↗

Set an attribute of multiple nodes datavalue is a ua.DataValue object

(self, nodeids, datavalues, attributeid=ua.AttributeIds.Value)

Source from the content-addressed store, hash-verified

659 return response.Results
660
661 def set_attributes(self, nodeids, datavalues, attributeid=ua.AttributeIds.Value):
662 """
663 Set an attribute of multiple nodes
664 datavalue is a ua.DataValue object
665 """
666 self.logger.info("set_attributes of several nodes")
667 request = ua.WriteRequest()
668 for idx, nodeid in enumerate(nodeids):
669 attr = ua.WriteValue()
670 attr.NodeId = nodeid
671 attr.AttributeId = attributeid
672 attr.Value = datavalues[idx]
673 request.Parameters.NodesToWrite.append(attr)
674 data = self._uasocket.send_request(request)
675 response = struct_from_binary(ua.WriteResponse, data)
676 response.ResponseHeader.ServiceResult.check()
677 return response.Results
678

Callers 1

set_valuesMethod · 0.80

Calls 3

struct_from_binaryFunction · 0.90
send_requestMethod · 0.80
checkMethod · 0.80

Tested by

no test coverage detected