-
Notifications
You must be signed in to change notification settings - Fork 373
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
Can't write values... datatype error? #1783
Comments
I don't think is a duplicate one because I already do that things from the other issues and I can't reach the write: I already import ua from asyncua
I can't do this in my ua.DataValue, for example:
And I get this error: do you have some other advise? it's seems all looks good... but I can't get the error |
looks like a siemens plc e.g. S7 1200/1500 there are only two options: timestamps = None dv = ua.DataValue(
Value=ua.Variant(100.0, ua.VariantType.Double),
StatusCode_=ua.StatusCodes.Good,
ServerTimestamp=None,
SourceTimestamp=None
) timestamps set! dv = ua.DataValue(
Value=ua.Variant(100.0, ua.VariantType.Double),
StatusCode_=ua.StatusCodes.Good,
ServerTimestamp=datetime.datetime.now(datetime.timezone.utc),
SourceTimestamp=datetime.datetime.now(datetime.timezone.utc)
) otherwise time/zone is something else... PLC always have issues with time so most don't like timestamps... |
Hello everyone,
I'm trying to write a variable in a tag/node of the PLC with asyncio and I can't do it... I don't know what could be happening, if you know something that could help me I would appreciate it.
I can connect, readValues, getNodes etc... but can't write, and tag is writable.
I've tried both with write_values([nodeIds], [valuesToWrite]) and with write_value(nodeId, valueToWrite) and it's not working...
Here is the part of the code, let me explain you:
node in zip:
[ns=3;s="EQ11_PH1"."TO"."TEST1"]
value in zip:
DataValue(Value=Variant(Value='1', VariantType=<VariantType.Int16: 4>, Dimensions=None, is_array=False), StatusCode_=StatusCode(value=0), SourceTimestamp=None, ServerTimestamp=None, SourcePicoseconds=None, ServerPicoseconds=None)
And I get that error:
Error writing tag: required argument is not an integer
I try to write into the node directly like this too:
And then I get that error:
"Error writing tag: The server does not support writing the combination of value, status and timestamps provided.(BadWriteNotSupported)"
It seems something happens in the dataValue, that's my code to get it:
valorOK2 = ua.DataValue(ua.Variant(value, ua.VariantType(switch_opc_data_type(tag['DATATYPE']))))
where datatype is FLOAT,INT,DEC, etc... and I switch to a valid opc_data_type:
That's all I think... so if someone can help me I would appreciate it!
Thanks!
The text was updated successfully, but these errors were encountered: