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

Method get_attribute_value

opcua/server/address_space.py:644–660  ·  view source on GitHub ↗
(self, nodeid, attr)

Source from the content-addressed store, hash-verified

642 self._nodes = LazyLoadingDict(shelve.open(path, "r"))
643
644 def get_attribute_value(self, nodeid, attr):
645 with self._lock:
646 self.logger.debug("get attr val: %s %s", nodeid, attr)
647 if nodeid not in self._nodes:
648 dv = ua.DataValue()
649 dv.StatusCode = ua.StatusCode(ua.StatusCodes.BadNodeIdUnknown)
650 return dv
651 node = self._nodes[nodeid]
652 if attr not in node.attributes:
653 self.logger.warning("Tried to read attribute '%s' in %s, but the attribute is missing", attr, nodeid)
654 dv = ua.DataValue()
655 dv.StatusCode = ua.StatusCode(ua.StatusCodes.BadAttributeIdInvalid)
656 return dv
657 attval = node.attributes[attr]
658 if attval.value_callback:
659 return attval.value_callback()
660 return attval.value
661
662 def set_attribute_value(self, nodeid, attr, value):
663 with self._lock:

Callers 6

readMethod · 0.80
writeMethod · 0.80
trigger_datachangeMethod · 0.80
_eval_opMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected