Reputation: 11
my first question here, I hope I can explain well, I am Spanish
I want to create alarms depending on customer specifications, created as attributes in the customer and in assets containers of the devices. But alarms created in the device profile as said in the point 6 of the https://thingsboard.io/docs/user-guide/device-profiles/ is not working as I would like to work, as a dynamic value inherit from owner, taking the value from the customer or the asset attriburte, it is always one value for every device you create with that profile. Do you know if I have to create different profiles for every different customer specification, or to manage the alarms other way as in rule chains?
I don't want to create the threshold in every device as i have lots of devices...but I think it is going to be the only workaround for me...
For example, imagine termometers with different threshold specified in the customer, alarm should be created when they reach different tempMAX , depending the customer has specified. I would create the thermometerProfile as in the image (image), but that doesnt take the value tempMAX from the customer or the asset (created as a attribute TempMAX in both customer and asset) despite having the "Inherit from owner" checkbox activated
I expect to get the alarm depending on the customer thresholds but it is acting as a constant threshold for every device with that profile
Thanks in advance
Upvotes: 0
Views: 308
Reputation: 81
Your way to go is set up alarms in the Rulechain. Just beacuse you're using a device profile, you can also associate that device profile to be processed by a specific rulechain. There you will have more programmatic freedom.
Let's supose you want to set a simple alarm for a device attribute threshold, and a high alarm and email sending for a surplus of a delta designated by the customer owner of that device. You could use the green OriginatorAttributesNode, the green CustomerAttributesNode, some yellow FilterScript and the AlarmNode to set an algorithm as follows
The data in both green enrichment nodes load as string. You have to parse them. So, the second filter node script could get like:
var th = metadata.ss_threshold;
var customerTh = metadata.customerThreshold;
if (th && customerTh) return msg.temp > parseFloat(th)+parseFloat(customerTh);
return true; // tell there is no customer threshold set
Hope being of help.
Upvotes: 0