cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Setting Alert Overrides Programmatically

Highlighted
Newbie

Setting Alert Overrides Programmatically

Hi All

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?

Many Thanks

Ashley

Tags (1)
14 REPLIES 14

Re: Setting Alert Overrides Programmatically

Ashley, have you tried using the 'DisableAlertsForProperty' service? You should be able to disable specific alerts on specific properties for that Thing.

Re: Setting Alert Overrides Programmatically

Hi Aanjan,

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?

Thanks

Ashley

Re: Setting Alert Overrides Programmatically

Ashley, is that a Remote Thing/ Remote property by any chance?

Re: Setting Alert Overrides Programmatically

It is a Remote Thing but local properties that have the Alerts on them (which are Booleans).

Re: Setting Alert Overrides Programmatically

Bump

Re: Setting Alert Overrides Programmatically

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!

Re: Setting Alert Overrides Programmatically

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.

Many Thanks

Ashley Gibson

Re: Setting Alert Overrides 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!

Re: Setting Alert Overrides Programmatically

Fantastic, thank you Aanjan!