Search code examples
javascriptiotthingsboard

Acces to thingsboard shared attribute


i'am trying to call a shared attribute for a device (thingbsoard) with the rule chain so i can apply an if statement on it , but i dont know how to do it , is there anyway that allow me to call attributes in rule chain please ?

this is the example i used , but i'am sure that the get function is wrong .

var shared_att = global.getSharedAttributeValue("threshold");
if (shared_att > 50) {
// Trigger an alarm
var alarm = {
    type: "Temperature",
    severity: "Critical",
    description: "Temperature has exceeded the threshold of 50 degrees.",
    status: "Active"
};

Solution

  • Use Originator attributes rule node to fetch any type of attributes.