createEntityAttributesSubscription static method
TelemetrySubscriber
createEntityAttributesSubscription({
- required TelemetryService telemetryService,
- required EntityId entityId,
- required String attributeScope,
- List<
String> ? keys,
Implementation
static TelemetrySubscriber createEntityAttributesSubscription(
{required TelemetryService telemetryService,
required EntityId entityId,
required String attributeScope,
List<String>? keys}) {
SubscriptionCmd subscriptionCommand;
var subscriptionKeys = keys != null ? keys.join(',') : null;
if (attributeScope == LatestTelemetry.LATEST_TELEMETRY.toShortString()) {
subscriptionCommand = TimeseriesSubscriptionCmd(
entityId: entityId.id!,
entityType: entityId.entityType,
keys: subscriptionKeys);
} else {
var scope = attributeScopeFromString(attributeScope);
subscriptionCommand = AttributesSubscriptionCmd(
entityId: entityId.id!,
entityType: entityId.entityType,
keys: subscriptionKeys,
scope: scope);
}
return TelemetrySubscriber(telemetryService, [subscriptionCommand]);
}