Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How-to rename object on running opc ua server? #1766

Open
PetroGolovnya opened this issue Dec 23, 2024 · 1 comment
Open

How-to rename object on running opc ua server? #1766

PetroGolovnya opened this issue Dec 23, 2024 · 1 comment

Comments

@PetroGolovnya
Copy link

PetroGolovnya commented Dec 23, 2024

Describe the bug

I trying to rename object on running opc ua server.
From old DisplayName is 'SNMP' to new DisplayName is 'SNMP changed'.
But object name in tree not changed.
Code received new name from redis subscription.

To Reproduce

Here is code example:
`async def object_changed(jval):
org_id = jval["args"]["id"]
query = "SELECT po.id_p, po.address, p.name FROM page_object AS po LEFT JOIN page AS p ON "
query += f"p.id_p=po.id_p WHERE po.id_p={org_id}"
org, = await db.select(query, f"Database error on object {org_id}:")
node_ = server.get_node(ua.NodeId(org_id, 1))
display_name = await node_.read_display_name()

if org["name"] != display_name.Text:       
    now = datetime.datetime.now()
    await node_.write_attribute(ua.AttributeIds.DisplayName, \
        ua.DataValue(ua.uatypes.LocalizedText(org["name"].replace(':', ' ')), \
        ua.StatusCode(0), now.replace(tzinfo=tz_local).astimezone(tz_utc)))        
    await node_.write_attribute(ua.AttributeIds.BrowseName, \
        ua.DataValue(ua.uatypes.QualifiedName(org["name"].replace(':', ' ')), \
        ua.StatusCode(0), now.replace(tzinfo=tz_local).astimezone(tz_utc))) 
    await node_.write_attribute(ua.AttributeIds.Description, \
        ua.DataValue(ua.uatypes.LocalizedText(org["name"].replace(':', ' ')), \
        ua.StatusCode(0), now.replace(tzinfo=tz_local).astimezone(tz_utc)))`

Screenshots

Screenshot attached
snmp_plc

Version

Python-Version: 3.11.2 x64

opcua-asyncio Version (e.g. master branch, 0.9): asyncua-1.1.5

@AndreasHeine
Copy link
Member

why do you think its an issue of asyncua? in the attributes tab it shows the current value so from library side its working!
its more likely an issue in the client software not refreshing!
maybe close and reopen the parent folder/object so it will rebrowse/reread?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants