Giter Site home page Giter Site logo

Comments (8)

zerox1212 avatar zerox1212 commented on August 22, 2024

Update:
I found the problem.

    def _parse_value(self, el, obj):
        for val in el:
            ntag = self._retag.match(val.tag).groups()[1]
            obj.valuetype = ntag
            if ntag in ("Int32", "UInt32"):
                obj.value = int(val.text)
            elif ntag in ('ByteString', 'String'):
                mytext = val.text.replace('\n', '').replace('\r', '')
                # obj.value.append('b"{}"'.format(mytext))
                obj.value = mytext
            elif ntag == "ListOfExtensionObject":
                self.logger.info("Value type not implemented: %s", ntag)
            elif ntag == "ListOfLocalizedText":
                self.logger.info("Value type not implemented: %s", ntag)
            else:
                self.logger.info("Value type not implemented: %s", ntag)

Should probably throw a TODO in that code since the XML importer doesn't even support the OPC UA base variants.

For now I added this code:

elif ntag in ("Float"):
      obj.value = float(val.text)

If I get time I will fork and implement all the base types.

from python-opcua.

zerox1212 avatar zerox1212 commented on August 22, 2024

So, another part of this issue with the importer.

The code that checks for a value won't write a "0.0" to the variable node.

    def add_variable(self, obj):
        ...
        if obj.value:
            attrs.Value = ua.Variant(obj.value, getattr(ua.VariantType, obj.valuetype))

This if statement should probably check for null's instead (is not None), but I don't know if this would cause problem with other value data.

from python-opcua.

oroulet avatar oroulet commented on August 22, 2024

Yes parsing of values is half implemented. There is a bug for it. Would be
nice if you could fix it.

On Thu, Oct 29, 2015, 17:57 zerox1212 [email protected] wrote:

So, another part of this issue with the importer.

The code that checks for a value won't write a "0.0" to the variable node.

def add_variable(self, obj):
    ...
    if obj.value:
        attrs.Value = ua.Variant(obj.value, getattr(ua.VariantType, obj.valuetype))

This if statement should probably check for null's instead.


Reply to this email directly or view it on GitHub
#53 (comment)
.

from python-opcua.

zerox1212 avatar zerox1212 commented on August 22, 2024

After using the XML to import nodes, how can I access the nodes created by the server? For example if I want to subscribe to one.
server.get_node returns a node object even if the node doesn't exist.
Is there a way to get all the nodes that exist on the server?

from python-opcua.

oroulet avatar oroulet commented on August 22, 2024

get_node just constucts an Node object. If you want if the node is valid call a method from it.
it looks like you create a node which is child of node i=30001. so get that node and call get_children og get_child

s there a way to get all the nodes that exist on the server?

A server has so many nodes, you do not want to do that....

from python-opcua.

zerox1212 avatar zerox1212 commented on August 22, 2024

I got some time to add a few fixes to the xml importer. I submitted a pull request. I hope I did it correct, it's my first pull request ever.

from python-opcua.

zerox1212 avatar zerox1212 commented on August 22, 2024

Quick question:
How can I import the NodeID as String instead of Numeric? NodeID 30,000 isn't very nice.

from python-opcua.

oroulet avatar oroulet commented on August 22, 2024

from python-opcua.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.