Ive noticed that the .lastchange property changes when the quality changes. should it work that way? seems like the .lastchange should only change if the value changes.
Technically, the value and quality are actually bundled together, and along with the timestamp, come from the OPC server. When the quality changes, a new value is generated, and is received by that tag. It’s up to the opc server/driver as to whether the timestamp should be updated.
That doesn’t mean it can’t be changed, but it would probably have some implications for things like using the timestamp of the device for the tag history timestamp source.
If you need to trigger something off of a tag change, and depending on where you want to do it, you may be able to use the expression function “hasChanged(value,[include quality])”. If the second parameter is false, quality won’t be included in the evaluation.