1

enter image description hereI 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.

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...

sam
  • 61
  • 2
  • 14

1 Answers1

1

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.

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.

Script code:

msg = {};
msg.alarm = true;
metadata = {};
metadata.alarm = true;
msgType = "POST_ATTRIBUTES_REQUEST";
return {msg: msg, metadata: metadata, msgType: msgType};
  • I did what you mentioned however I get "java.lang.IllegalArgumentException: Unsupported msg type: ALARM" on the Save Attributes node. Does the Originator node come before or after the Save Attributes node? – sam Mar 12 '19 at 00:36
  • 1
    Need to update the msgType using a script before sending the data to the save attribute node. Updated my answer. – Roni Beitel Mar 12 '19 at 12:23