AnsweredAssumed Answered

Easy way to insert PI Data at the current server time using the SOAP interface

Question asked by AbelHeinsbroek on Aug 4, 2016
Latest reply on Aug 4, 2016 by Ahmad Fattahi

Hi there,


I'm using Python to communicate with the PI SOAP Web Services (we don't have the REST-web api available yet unfortunately), which works fine for now.

I am however, running into minor problems writing data to PI tags due to time synchronization differences between servers.


Is there a convenient way to write data to a PI tag at the current server time? Providing the SOAP function with "*" as date does not work.


Below is the code I currently use:


def insert_value(self, tag, value,

      aos = self.client.factory.create("ArrayOfTimeSeries");
      timeseries = self.client.factory.create("TimeSeries");

      aof = self.client.factory.create("ArrayOfTimedValue");
      timedvalue = self.client.factory.create("TimedValue");
      timedvalue.value = value
      timedvalue._Time = time
      aof.TimedValue = [timedvalue]
      timeseries.TimedValues = aof
      timeseries._Path = tag

      aos.TimeSeries = [timeseries]
      # write to server