-
Hello everyone, myvar2 = await myobj.add_variable(idx, "myvar", 0.0)
await myvar2.set_writable() And after not being able to change it, I tried adding a new object and set that object to writable as: myobj2 = await server.nodes.objects.add_object(idx, "MyObject2")
await myobj2.set_writable()
myvar2 = await myobj2.add_variable(idx, "myvar", 0.0)
await myvar2.set_writable() But I'm still not able to write any value to it from a client. In this last configuration I even get an error: Traceback (most recent call last):
File "C:\InLav\Gianluca\Python\Server_opcua\test.py", line 153, in <module>
asyncio.run(main())
File "C:\Anaconda3\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Anaconda3\lib\asyncio\base_events.py", line 647, in run_until_complete
return future.result()
File "C:\InLav\Gianluca\Python\Server_opcua\test.py", line 106, in main
await myobj2.set_writable()
File "C:\Anaconda3\lib\site-packages\asyncua\common\node.py", line 244, in set_writable
await self.set_attr_bit(ua.AttributeIds.AccessLevel, ua.AccessLevel.CurrentWrite)
File "C:\Anaconda3\lib\site-packages\asyncua\common\node.py", line 251, in set_attr_bit
dv = await self.read_attribute(attr)
File "C:\Anaconda3\lib\site-packages\asyncua\common\node.py", line 304, in read_attribute
result[0].StatusCode.check()
File "C:\Anaconda3\lib\site-packages\asyncua\ua\uatypes.py", line 328, in check
raise UaStatusCodeError(self.value)
asyncua.ua.uaerrors._auto.BadAttributeIdInvalid: "The attribute is not supported for the specified Node."(BadAttributeIdInvalid) The error happens when I use the Can you help me ? Am I doing something wrong ? Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 8 replies
-
what does the client return? an ErrorStatusCode like BadNotWritable? |
Beta Was this translation helpful? Give feedback.
-
Sorry to have bothered you. I've used UaExpert instead of a python opcua-client and was able to write the value to "myvar" correctly. Then I searched what was wrong with the other client and all seems to work. I get this error when I use the Traceback (most recent call last):
File "C:\InLav\Gianluca\Python\Server_opcua\test.py", line 153, in <module>
asyncio.run(main())
File "C:\Anaconda3\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Anaconda3\lib\asyncio\base_events.py", line 647, in run_until_complete
return future.result()
File "C:\InLav\Gianluca\Python\Server_opcua\test.py", line 106, in main
await myobj2.set_writable()
File "C:\Anaconda3\lib\site-packages\asyncua\common\node.py", line 244, in set_writable
await self.set_attr_bit(ua.AttributeIds.AccessLevel, ua.AccessLevel.CurrentWrite)
File "C:\Anaconda3\lib\site-packages\asyncua\common\node.py", line 251, in set_attr_bit
dv = await self.read_attribute(attr)
File "C:\Anaconda3\lib\site-packages\asyncua\common\node.py", line 304, in read_attribute
result[0].StatusCode.check()
File "C:\Anaconda3\lib\site-packages\asyncua\ua\uatypes.py", line 328, in check
raise UaStatusCodeError(self.value)
asyncua.ua.uaerrors._auto.BadAttributeIdInvalid: "The attribute is not supported for the specified Node."(BadAttributeIdInvalid) |
Beta Was this translation helpful? Give feedback.
-
Answer explained by AndreasHeine in the comments! Is there a way to allocate a variable at a specific address ? I have a project which uses the old version of opcua server. So I'd like for something like ns=2;i=30 for my variable (with add_variable) |
Beta Was this translation helpful? Give feedback.
Answer explained by AndreasHeine in the comments!
Is there a way to allocate a variable at a specific address ?
I have a project which uses the old version of opcua server. So I'd like for something like
ns=2;i=30 for my variable (with add_variable)