我正在尝试根据在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中获取地图小部件的警报数据?
发布评论