Replies: 2 comments 4 replies
-
input returns a stirng. you need to write a bool object. you can use a serach engine to learn how to convert a string to a boolean |
Beta Was this translation helpful? Give feedback.
3 replies
-
In python type() doesn't cast a value. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
value = await myvarnode.get_value()
print("Old Value: " + value)
newvalue = input("New Value: ")
dv = ua.DataValue(ua.Variant(type(value)(newvalue), myvarianttype))
await myvarnode.write_attribute(ua.AttributeIds.Value, dv)
VariantType.Boolean does not work if newvalue is 0 or 1 or True or False etc. How should I input boolean values for this code?
VariantType.Int32 is working just fine with same code.
I can read value just fine, (old value shows "True" or "False") just not write so connection is working. I do not get any visible errors either. It just does not change value on server.
What I am guessing is that I am trying to input value in wrong format, but cannot figure out how.
Beta Was this translation helpful? Give feedback.
All reactions