ThingsBoard:在图表小部件中绘制带有未来时间戳的时间序列 [英] ThingsBoard: plot timeseries with future timestamps in a chart widget

查看:112
本文介绍了ThingsBoard:在图表小部件中绘制带有未来时间戳的时间序列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近几天,我在结核病方面遇到了一些麻烦.

I've been having some troubles with TB in the last days.

我有一个通用变量(例如,假设外部温度),该度量是使用MQTT和tb-gateway实时获取的.我还具有给定未来时间段的变量预测,可以通过MQTT从执行预测的Python模块中获取.我希望使用两条不同的曲线在同一图形中同时绘制给定时间段(假设下一个 24小时)的实时采集数据和预测趋势.

I have a generic variable (let's assume, for example, the external temperature), which measures are acquired at realtime using MQTT and tb-gateway. I also have the variable forecasts for a given future time period, acquired via MQTT from a Python module which performs the forecasting. I wish to plot in the same graph both the data acquired at realtime and the forecasted trend for a given time period (let's say for the next 24 hours), using two different curves.

现在,我利用ThingsBoard的时间戳映射功能,成功地(通过MQTT)上传了具有正确的未来时间戳的预测时间序列.

Now, I managed to upload (via MQTT) the forecasted timeseries with the correct future timestamps, exploiting the timestamp mapping feature of ThingsBoard.

在图表上绘制这些信息时,我发现ThingsBoard只能绘制与当前系统时间戳或过去时间戳相关的时间序列值.我正在尝试找到一种在图表窗口小部件上绘制与未来时间戳相关的时间序列数据的方法.

When it came to plot these information on a chart, I found out that ThingsBoard can only plot timeseries values related to the current system timestamp or past timestamps. I am trying to find a way to plot timeseries data related to future timestamps on the chart widget.

有人遇到过同样的问题并设法解决了吗?

Anybody experienced the same issue and managed to solve it?

推荐答案

简短的回答:,您将需要创建一个自定义小部件来实现您的案例.

Short answer: you will need to create a custom widget for implementing your case.

详细答案:

当您使用"实时-最后XXX "时间窗口时,小部件实际上会为温度遥测创建一个订阅.由于已创建订阅,因此即使将来是时间戳记,Thingsboard后端也会将所有 temperature 更新发送到UI.但是标准图表小部件将拒绝所有来自未来"的遥测技术.

When you are using 'Realtime - Last XXX' time window, widget actually creates a subscription for the temperature telemetry. Since subscription is created, the Thingsboard backend will send all temperature updates to the UI even if the timestamp is in the future. But standard chart widgets will reject all telemetries that are 'from future'.

您可以打开浏览器控制台的网络"标签并查看WebSocket活动-将来的遥测信息将传输到UI.

You can open the browser console 'network' tab and view WebSocket activity - telemetry from future is transmitted to the UI.

另一个问题是标准的Thingsbarod时间范围选择器不允许选择未来"时间范围.

Another problem is that standard Thingsbarod Time Range picker does not allow to select 'future' time range.

与此同时,Thingsboard REST API不会验证请求的 startTs endTs ,因此您可以轻松地从将来"下载遥测.

In the same time, Thingsboard REST API does not validate startTs and endTs of the request so you can easily download telemetry 'from the future'.

因此,我建议创建自定义图表窗口小部件,该窗口小部件将包含其自己的时间范围选择器,并将使用REST API请求数据. https://thingsboard.io/docs/reference/rest-api/

So I recommend to create custom chart widget that will contain its own time-range picker and that will request data using REST API. https://thingsboard.io/docs/reference/rest-api/

这篇关于ThingsBoard:在图表小部件中绘制带有未来时间戳的时间序列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆