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

client connect kapware, set_value return BadWriteNotSupported #919

Open
xyx518809 opened this issue Dec 3, 2019 · 11 comments
Open

client connect kapware, set_value return BadWriteNotSupported #919

xyx518809 opened this issue Dec 3, 2019 · 11 comments

Comments

@xyx518809
Copy link

I try to write a data to kapware, use the function set_value.
if I write like this:

var4 = client.get_node('ns=2;s=13#Package01.13#Package01.D11900')
datavalue = ua.DataValue(ua.Variant(1, ua.VariantType.Int16))
datavalue.SourceTimestamp = datetime.utcnow()
var4.set_value(datavalue)

the program will raise an error.

opcua.ua.uaerrors._auto.BadWriteNotSupported: The server does not support writing the combination of value, status and timestamps provided.(BadWriteNotSupported)

and if I write like this:

var4 = client.get_node('ns=2;s=13#Package01.13#Package01.D11900')
datavalue = ua.DataValue(ua.Variant(1, ua.VariantType.Int16))
#datavalue.SourceTimestamp = datetime.utcnow()
var4.set_value(datavalue)

The program is OK.

I want to know why this happened, thank you.

@zerox1212
Copy link
Contributor

zerox1212 commented Dec 3, 2019

Probably because Kepware OPC UA is junk. What happens if you write value with UaExpert? Does it send SoureTimestamp that works?

@oroulet
Copy link
Member

oroulet commented Dec 3, 2019

this has nothing to do with our software. It is limitation of kepware. Send them emails so maybe one day they will fix their server

@schroeder-
Copy link
Contributor

It's not kepwares fault. From OPC UA Specification Part 4:

If the SourceTimestamp or the ServerTimestamp is specified, the Server shall use these values. The Server returns a Bad_WriteNotSupported error if it does not support writing of timestamps.

@oroulet
Copy link
Member

oroulet commented Dec 3, 2019

Exactly what i wrote

@zerox1212
Copy link
Contributor

@schroeder- What "production" server wouldn't even support timestamps lol?

@schroeder-
Copy link
Contributor

schroeder- commented Dec 3, 2019

The quote is for write request which tries to set the server timestamp and a DataValue.

You don't want the server timestamp from a DataValue written by a client. Because most servers use the server timestamp for caching and subscription book keeping. Also you want the server timestamp the time when the value changed on the server, not when the client send a write request. Thats why must servers dont allow setting the server timestamp of a datavalue.

@oroulet
Copy link
Member

oroulet commented Dec 3, 2019

I think the only server I have heard complaining about our cliet behaviour is kepware.

You don't want the server timestamp from a DataValue written by a client.

I jsut double check the code and serverTimestamp is not written by default, only the source timestamp. which, in my mind, is correct. since the progam writting is, per definiton, the source.

What do you want to change here? if you have a special server, or special requirements, you just write a DataValue and do not let python-decide guess what you want.

@schroeder-
Copy link
Contributor

I wouldn't set any timestamp per default as the Specification allow to reject any timestamp writes.

@oroulet
Copy link
Member

oroulet commented Dec 3, 2019

I think we tried that one. but then many servers expected it. setting it is not wrong, it is a sensible default and the API let's you do something else if you want to.
the strange/bad stuff here is that kepware does not support it. This is the only one I know of. I am sure you can find more.

@zerox1212
Copy link
Contributor

zerox1212 commented Dec 3, 2019

@schroeder- Per the standard Kepware is fine to block the write, but it's still seems lazy to me. Also, the SourceTimestamp is being written which makes sense for a Client to do. The example above is not doing anything ServerTimestamp.

At any rate this issue should be closed. There is nothing we can do about Kepware here.

@schroeder-
Copy link
Contributor

Yeah keep it as it is.
You just wanted to give @xyx518809 a explanation why Kepware can disalow to set the source timestamp.

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

4 participants