@@ -126,6 +126,39 @@ def syncdata(self, last_transaction_id=None):
126126 data ["lastTransactionId" ] = last_transaction_id
127127 return self ._request (url = self ._build_url ("syncdata" ), data = data )
128128
129+ def getdata (self , ewon_id , tag_id , from_ts , to_ts , limit = None ):
130+ """
131+ ``getdata`` is used as a “one-shot” request to retrieve filtered data based on specific
132+ criteria. It is not destined to grab historical data with the same timestamp or enormous
133+ data involving the use of the moreData filter.
134+
135+ :param ewon_id: The ID of the single Ewon gateway for which data from DataMailbox is requested.
136+ :param tag_id: ID of the single tag for which data from DataMailbox is requested.
137+ :param from_ts: Timestamp after which data should be returned. No data older than this time stamp will
138+ be sent in ISO format.
139+ :param to_ts: Timestamp before which data should be returned. No data newer than this time stamp
140+ will be sent in ISO format
141+ :param limit: The maximum amount of historical data returned.
142+ The historical data is the historical tag values but also the historical alarms. If you set the
143+ limit to 4, the response will consist in 4 historical tag values and 4 historical alarms (if
144+ available) for each tag of each Ewon gateway allowed bu the Talk2M token.
145+ If the size of the historical data saved in the DataMailbox exceeds this limit, only the
146+ oldest historical data will be returned and the result contains a moreDataAvailable value
147+ indicating that more data is available on the server.
148+ If limit is not used or is too high, the DataMailbox uses a limit pre-defined in the system
149+ (server-side).
150+ """
151+ data = {
152+ ** self .data ,
153+ "ewonId" : ewon_id ,
154+ "tagId" : tag_id ,
155+ "from" : from_ts ,
156+ "to" : to_ts ,
157+ }
158+ if limit :
159+ data ["limit" ] = limit
160+ return self ._request (url = self ._build_url ("getdata" ), data = data )
161+
129162 def iterate_syncdata (self , last_transaction_id = None ):
130163 """
131164 Returns an iterator on syncdata.
0 commit comments