Getting time series data from Arduino IoT API

Hi, I'm having a problem with the Arduino IoT API. I'm trying to use the devicesV2TimeSeries function to get historical data (time series). I keep getting an error: "Invalid value for last_evaluated_key , must not be None ". Can you please look into this, as the documentation says nothing about it? Let me know if there is a different way to get historical data, I would greatly appreciate it.

It looks like the issue came up in the past, but never got resolved. Cannot Get devicesV2TimeSeries to return valid results - #3 by jmdodd95682

Hi!
I guess you are using the Python library. If so, can you use the v1.4.4 of the library?
What you describe seems to be and old issue that was already solved with that version.

Thanks. Now I don't get an error, but I do have another problem that I am not getting any time series data.

api2 = iot.DevicesV2Api(client)
DEVICE_ID = '7bb6a71e-8995-46cf-9ebc-b424a52e207d'
prop_id = '5fc50011-5844-4d8a-aba2-1de79b19238e'
date="2023-07-07T10:00:00Z"
try:
    resp=api2.devices_v2_timeseries(DEVICE_ID, prop_id,limit=2,start=date)
    print('resp ', resp)
except ApiException as e:
    print("Got an exception: {}".format(e))

I get this response:
resp {'id': '7bb6a71e-8995-46cf-9ebc-b424a52e207d',
'last_evaluated_key': None,
'name': '5fc50011-5844-4d8a-aba2-1de79b19238e',
'values': []}

But I know that there is data as I get the latest value with a request using the properties_V2_list:

api = iot.PropertiesV2Api(client)
resp = api.properties_v2_list(thing_id)
print('thing_id resp ',resp)

Response is:
'href': '/iot/v1/things/f31dbcb6-1ca2-4008-8683-a472157798d3/properties/5fc50011-5844-4d8a-aba2-1de79b19238e',
'id': '5fc50011-5844-4d8a-aba2-1de79b19238e',
'last_value': 25.489999771118164,
'max_value': None,
'min_value': None,
'name': 'Node1_Temperature',
'permission': 'READ_ONLY',
'persist': True,
'sync_id': None,
'tag': 6.0,
'thing_id': 'f31dbcb6-1ca2-4008-8683-a472157798d3',
'thing_name': '... monitor',
'type': 'FLOAT',
'update_parameter': 100.0,
'update_strategy': 'TIMED',
'updated_at': datetime.datetime(2023, 5, 4, 0, 56, 11, 451640, tzinfo=tzutc()),
'value_updated_at': datetime.datetime(2023, 8, 2, 22, 53, 42, 45000, tzinfo=tzutc()),
'variable_name': 'node1_Temperature'}, {'created_at': datetime.datetime(2023, 5, 4, 0, 53, 58, 225674, tzinfo=tzutc()),
'deleted_at': None,

Why is it that I am not getting the historical values using the devices_v2_timeseries()?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.