set_writable(), but only for value #450
Unanswered
tomasgiden
asked this question in
Q&A
Replies: 1 comment 11 replies
-
I can confirm that issue. Minimal example to reproduce: Client: import asyncio
import sys
# sys.path.insert(0, "..")
import logging
from asyncua import Client, Node, ua
logging.basicConfig(level=logging.INFO)
_logger = logging.getLogger('asyncua')
async def main():
url = 'opc.tcp://0.0.0.0:4840/freeopcua/server/'
async with Client(url=url) as client:
uri = 'http://examples.freeopcua.github.io'
idx = await client.get_namespace_index(uri)
var = await client.nodes.root.get_child(["0:Objects", f"{idx}:MyObject", f"{idx}:Problematic_Bool"])
print("Problematic_Bool", var, await var.read_value())
await var.write_value(123, ua.VariantType.Int32)
print("Problematic_Bool", var, await var.read_value())
if __name__ == '__main__':
asyncio.run(main()) Server: import logging
import asyncio
import sys
sys.path.insert(0, "..")
from asyncua import ua, Server
from asyncua.common.methods import uamethod
logging.basicConfig(level=logging.INFO)
_logger = logging.getLogger('asyncua')
async def main():
server = Server()
await server.init()
server.set_endpoint('opc.tcp://0.0.0.0:4840/freeopcua/server/')
uri = 'http://examples.freeopcua.github.io'
idx = await server.register_namespace(uri)
myobj = await server.nodes.objects.add_object(idx, 'MyObject')
myvar = await myobj.add_variable(idx, 'Problematic_Bool', ua.Variant(True, ua.VariantType.Boolean))
await myvar.set_writable()
_logger.info('Starting server!')
async with server:
while True:
await asyncio.sleep(1)
if __name__ == '__main__':
asyncio.run(main()) That leads in UAExpert to: |
Beta Was this translation helpful? Give feedback.
11 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
If I set a variable to be writable with set_writable() and a buggy client then writes to it but with another type than the variable was created with, the server happily accepts the write, changing both the type and the value in the process. I tried it from boolean to uint16_t. If this is not a bug, then how to I make the value writable but not any other information related to the node?
Beta Was this translation helpful? Give feedback.
All reactions