[Question] Dynamic subscription to data keys
Component
- UI
Description Out of the box Thingsboard lets user to configure widget "statically", i.e. this is done on creation or while updating widget configuration. Does custom widget API provide any way to dynamically subscribing to set of keys?
My case is: Each device has its own unique set of keys. And I want to display that data in widget something like already existing Entities table or Timeseries table. Additionally devices periodically send their vocabulary where each data key is described so I know the whole set of keys.
Environment
- ThingsBoard: 3.4.1
Almost as usual I helped to myself and suggest PR #7275. With this PR I would receive continuous updates in my custom widgets from all timeseries data keys without explicitly specifying them in widget configuration:
self.onInit = function() {
let utils = self.ctx.$scope.$injector.get(self.ctx.servicesMap.get('utils'));
utils.subscribeToEntityTelemetry(self.ctx).subscribe(
data => console.log('Data: ', data),
error => console.log('Error: ', error));
}
self.onDestroy = function() {
if (self.ctx.telemetrySubscriber) {
self.ctx.telemetrySubscriber.unsubscribe();
}
}
Waiting for review from core team...