是否可以在Thingsboard中获取地图小部件的警报数据?

编程入门 行业动态 更新时间:2024-10-26 15:16:04
本文介绍了是否可以在Thingsboard中获取地图小部件的警报数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试根据在Thingsboard中创建的警报更改标记。当前,标记正在显示我的数据源实体中的数据。但是,(我已经看到)无法添加类似于警报小部件的警报源。

I am trying to change my marker based on an alarm I've created in Thingsboard. Currently the marker is displaying data from my "datasource" entity. However there is no way (that I have seen) that you can add an "Alarm source" similar to the alarm widget.

可用数据是 f(data,images,dsData,dsIndex),我认为这只是数据遥测。

The data available is "f(data, images, dsData, dsIndex)" which I assume is only the data telemetry.

基本上,如果发生警报,​​我需要更改标记。我的警报触发器只是暂时关闭,所以我不能直接使用数据遥测...

Basically I need to change the marker if an alarm is going off. My alarm trigger only goes off momentarily so I can't use my data telemetry directly...

推荐答案

您可以尝试添加一个创建警报后,在警报规则链上添加新的保存属性。结合更改发起者,您可以将属性保存到特定设备。 然后,您可以在地图小部件上将新属性添加到数据源并按照该属性进行操作。 这是一种非常规的方法,但是它可能对您有用。

You can try adding a new "Save attribute" on the alarm rule chain, after the alarm is created. Combined with a "Change originator" you can save the attribute to a specific device. Then on the map widget you can add the new attribute to the datasource and act as per that attribute. It is a bit non-conventional approach, but it should probably work for you.

您应该有一个 Change Originator-> Script ->保存属性 在脚本项上,您应该将新属性插入数据并将msgType更新为 POST_ATTRIBUTES_REQUEST。我不确定您是否需要更新消息或元数据,但是我想您可以尝试看看。

You should have a "Change Originator"--> "Script" --> "Save Attribute" On the script item you should insert the new attribute to the data and update the msgType to "POST_ATTRIBUTES_REQUEST". I'm not sure if you need to update the message or metadata, but I guess you can try and see.

脚本代码:

msg = {}; msg.alarm = true; metadata = {}; metadata.alarm = true; msgType = "POST_ATTRIBUTES_REQUEST"; return {msg: msg, metadata: metadata, msgType: msgType};

更多推荐

是否可以在Thingsboard中获取地图小部件的警报数据?

本文发布于:2023-07-20 17:54:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1169729.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:警报   部件   地图   数据   Thingsboard

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!