thingsboard / dart_thingsboard_pe_client

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

TimeseriesSubscriptionCmd field startTs doesn't work? #14

Open sofiabukovskaya opened 10 months ago

sofiabukovskaya commented 10 months ago

I want to implement real-time data acquisition using a time filter (5 minutes or 10 minutes earlier from the current one). I wrote this kind of code:

final telemetryService = thingsBoardClient.getTelemetryService();
    final currentTime = DateTime.now();
    final startTime = currentTime.subtract(
      const Duration(minutes: 5),
    );

    final subscription = TelemetrySubscriber(
      telemetryService,
      [
        TimeseriesSubscriptionCmd(
          entityId: DeviceId(deviceId).id!,
          entityType: DeviceId(deviceId).entityType,
          startTs: startTime.millisecondsSinceEpoch,
        ),
      ],
    );

I receive device data in real time, but the problem is that the startTs parameter is ignored and the data does not arrive as I mentioned - 5 minutes earlier. If I need to use a different method or approach to obtain data from a certain time to now, I will be glad to hear help. In case if everything alright please look through my issue. I tested both IOS simulator and Android device Many thanks!