I have created Alerts on properties of ThingShapes and ThingTemplates. I notice that when enabling or disabling these Alerts (programmatically) whether they are disabled on a Thing or the Template/Shape that they are enabled/disabled acroos all Assets.
To get around this I notice that I can change the Alert on individual Things (in the Composer) to be Overriden. So that when enabling/disabling alerts on Things (programmatically) I am able to enable/disable them on only that Thing rather than across them all.
My question is, can I set an Alert to "Override" on a Thing Instance programmatically without having to go into the Composer?
Ashley, have you tried using the 'DisableAlertsForProperty' service? You should be able to disable specific alerts on specific properties for that Thing.
Apologies for the late reply.
Yes I assumed that executing this service on a Thing Instance would only disable the Alert for that Thing. However when executing DisableAlertsForProperty() (even on a Thing Instance) still disables that Alert for all Things in the ThingTemplate/ThingShape.
If I go into the Composer and Manage that Alert on the Thing Instance I am able to set an "Override" from the dropdown. When this is set I can then do the functionality I want with DisableAlertsForProperty() on that Instance. However my quesiton is can I set "Override" programmatically instead of having to go into the Composer for each Thing?
Ashley, it looks like 'DisableAlertsForProperty' disables that Alert for all Things that ThingShape/ Template is associated with (if done programmatically); same case with DisableAllAlerts, as it disables Alerts on all associated Things.
I'll go ahead and submit a Jira ticket with the devs regarding this. I'll you and this thread posted on any status updates. Thanks!
Many thanks for your help Aanjan.
Like I say there is a workaround for this whereby you can go into the Composer and change the Alert on the Implemented Thing to "Override" however I don't think this is possible to set programmatically.
Yep, that's the only workaround for now - manually going into each property and setting the override element for each to enable/ disable on that specific property. If you have alerts directly on the Thing (and not through a Shape or a Template) it works correctly, but that's not a practical solution (adding these directly for every single Thing). I'll keep you posted on any changes/ updates. Thanks again!