If you want to get to know about the changes in PIStateSets in PI server, we can monitor it using C#.
You need to get the PIStateSets Count using Count property and the using Refresh method you can get to know the PIStateSets collection updates by checking Count. For more details, please refer the below URL,
3 of 3 people found this helpful
I tend to think of state sets as being fairly static. Maintenance of them tends to occur rarely and most deliberately and intentionally by a PI Admin. I would like to hear more about your use-case regarding a more frequent need to change state sets. How many users in your environment are allowed to edit state sets? Usually there should be a small handful of PI Admins and they should communicate with one another and agree to such changes that will occur on the PIServer. So with proper planning and communication, there should be no surprise as to a sudden appearance of a state set.
The suggestion by Vasanth is more a pull operation. You would have a timer running that would periodically refresh the PIServer object and query the state sets. The count would not change is you added a new state set and deleted an old one. And even if the count did not change, it is possible that the individual states within the state set have changed, so you would have to query for that.
You may try a pull operation. Keep in mind I haven't tested this but the Live Library help explains it. You would subscribe to the PIServer.Changed event to see which sub-objects have changed. For a specific state set, which is actually an AFEnumerationSet object, you may subscribe to its AFEnumerationSet.Changed event.