Help for custom Driver

Hi,
I’m implementing a custom driver that reads a HTML page in a equipement that has an embedded web server.
This driver just reads the datas in a table in this page, create the opc-ua nodes on connect() with the header line found and updates the nodes at each update() with the values founded in the cells.
I actually used as the weather driver example an AbstractDriver.
As I saw in a other post, U say that if we want to make a real driver we have to make a AbstractNioDriver, so I’m going to do so.
My question is this one : I have to timestamp the datas with the datetime I found in the web page, as I need to history datas with the source timestamp and not the gateway timestamp. Would it be possible with a NioDriver and how ? I didn’t see the waay to do that in the modbus V2 sample.
Can we access the “LastChange” property of the tag ? Or is there an more “official” way to do this ?

Thanks for your help :scratch:

[quote=“GermainN”]Hi,
As I saw in a other post, U say that if we want to make a real driver we have to make a AbstractNioDriver, so I’m going to do so.
[/quote]

By “real” driver I mean one that talks to a PLC. For a driver like this extending NodeMapDriver, or even better the new AbstractTagDriver, is perfectly suited.

When you create a DataValue object you can set the source timestamp. Use the public DataValue(Variant value, StatusCode statusCode, UtcTime sourceTimestamp, UtcTime serverTimestamp) constructor.

Not from a driver, that’s a SQLTag property, not an OPC property.

Thanks Kevin.

I love this forum, your answers are so quick and effficient ! :smiley:

I didn’t mind of that, cause in the weather driver the DataNode .java did instanciate the DataVariableNode with a new UtcTime()… and I didn’t saw it.
I’m going to try this.

You might also want to explore implemented a SQLTag provider instead of a driver. There’s an example of that in the SDK as well, I think it’s called SimpleTagProvider.

You may also want to take a look at this topic.

It won’t be possible for me to use a TagProvider as I need to add a lot of devices with their own parameters (IP address, …). The OPC-UA driver correspond exactly to what I want to do. The equipement is a PLC but with no external protocol, this is why I use the embedded web server to catch the data.

I successfully tried the timestamping with the DataVariableNode, but I still have a problem…

If I change the value of the Node, I get it in the Tag in the Ignition Designer with the good timestamp on the LastChange Property. If I only change the timestamp (as the data value didn’t change in my web page), the tag is not refreshed in the Ignition designer.

If I use history, it archives the data only if the value changes (I use the Value timestamping for history of course).
When I use a transaction group, as the tag is calculated directly by the group, I always have the good value and timestamp.

Is there’s a way to use the History Provider the same way ?

Thanks again for your help :blush: