thingsboard / dart_thingsboard_client

ThingsBoard API client library for Dart developers.
BSD 3-Clause "New" or "Revised" License
59 stars 30 forks source link

[Issue] Method "getAttributeKeys" not working #25

Open fabioafreitas opened 7 months ago

fabioafreitas commented 7 months ago

Hello, i'm using the library version 1.0.8, fetching data from a account in https://thingsboard.cloud/.

I trying to fetch my device attributes using the following code:

var attrs = await tbClient
        .getAttributeService()
        .getAttributeKeys(DeviceId('4d1d43f0-a977-11ee-80a4-b9287a012345'));

Unfortunately it is not working and returning the following exception:

Error: ThingsboardError: message: [type 'List<dynamic>' is not a subtype of type 'List<String>?' in type cast], errorCode: 2, status: null
#0      toThingsboardError (package:thingsboard_pe_client/src/error/_thingsboard_error_handler_io.dart:89:18)
#1      ThingsboardClient.get (package:thingsboard_pe_client/src/thingsboard_client_base.dart:257:13)
<asynchronous suspension>
#2      AttributeService.getAttributeKeys (package:thingsboard_pe_client/src/service/attribute_service.dart:18:20)
<asynchronous suspension>
#3      main (file:///C:/Users/fbioa/Desktop/Personal%20Dev/Flutter_Estudos/thingsboard_client_tests/bin/thingsboard_client_tests.dart:56:9)
<asynchronous suspension>

I tested another method, the getLatestTimeseries, which receives the same EntityId as the first argument, to confirm if the problem was in there, but this method worked, therefore the arguments of the first method is correct. Here is the second method test:

var telemetry = await tbClient.getAttributeService().getLatestTimeseries(
        DeviceId('4d1d43f0-a977-11ee-80a4-b9287a012345'), ['temperature']);

Any clues for solving the first method problem?