Skip to main content
4-Participant
Oct 19, 2026 3:41 PM UTC
Solved

Heartbeat functionality for asset alerts

Hi,

I would like to understand best practice for the use case of developing a heartbeat function for alert duration. Let’s say an asset has an alert opened, the app should track the duration and trigger a service when the duration opened exceeds 1hour.

What would be the best practice to implement this feature given it will be used for many assets?

nmutterAnswer
17-Peridot
Oct 23, 2026 3:11 PM UTC

ThingWorx does not have an out of the box solution for that.

 

Have a look at Use Case 3 on

https://support.ptc.com/help/thingworx/platform/r10.2/en/#page/ThingWorx/Help/Composer/Things/ThingSubscriptions/ThingSubscriptions.html#wwID0EUZSW

“// Usecase 3: alert will be triggered if voltage is higher than 118V and it has last more than 3 minutes.”

I did not use the MultiEventSubscriptons - seem quite messy. Also with the example the alert conditions are coded into the code.

 

My idea would be similar to ​@CharlesJi - but more specific:

  • Define alert normal on the assets (without time aspect)
  • Create a scheduler running each minute or however precise you need the duration
  • In scheduler subscription call Resources[“AlertFunctions”].QueryAlertSummary  with a query matching the alert name(s) you want to monitor - so you have all alerts for all assets of that type with each duration (make sure to set maxItems high, so it also finds all your alerts if you have more than 500 (default maxItems=500))
  • If the duration is exceeding you can
    • call a service (but it would be called then on each scheduler run which might not be wanted)
    • set an extra property on the asset to true (e.g. alertName_longer2Hours), which has an alert set. which you can react on with a subscription. you should then also make sure to reset it to false, when initial alert is finished.

Maybe there are better ideas ;) 

2 replies

Support
Oct 22, 2026 3:24 AM UTC

Hi ​@BS_12822535 

I'm not sure I'd classify this as a heartbeat use case. One approach would be to use a Subscription to capture when an alert is triggered and then start a timer for the follow-up action. Another option is to run a Scheduler periodically (for example, every 5 minutes) to check for alerts that have been open for more than an hour and invoke a service when the threshold is exceeded. For a large number of assets, I'd generally lean toward the scheduler-based approach rather than maintaining an individual timer for each asset.

Translate
nmutter17-PeridotAnswer
17-Peridot
Oct 23, 2026 3:11 PM UTC

ThingWorx does not have an out of the box solution for that.

 

Have a look at Use Case 3 on

https://support.ptc.com/help/thingworx/platform/r10.2/en/#page/ThingWorx/Help/Composer/Things/ThingSubscriptions/ThingSubscriptions.html#wwID0EUZSW

“// Usecase 3: alert will be triggered if voltage is higher than 118V and it has last more than 3 minutes.”

I did not use the MultiEventSubscriptons - seem quite messy. Also with the example the alert conditions are coded into the code.

 

My idea would be similar to ​@CharlesJi - but more specific:

  • Define alert normal on the assets (without time aspect)
  • Create a scheduler running each minute or however precise you need the duration
  • In scheduler subscription call Resources[“AlertFunctions”].QueryAlertSummary  with a query matching the alert name(s) you want to monitor - so you have all alerts for all assets of that type with each duration (make sure to set maxItems high, so it also finds all your alerts if you have more than 500 (default maxItems=500))
  • If the duration is exceeding you can
    • call a service (but it would be called then on each scheduler run which might not be wanted)
    • set an extra property on the asset to true (e.g. alertName_longer2Hours), which has an alert set. which you can react on with a subscription. you should then also make sure to reset it to false, when initial alert is finished.

Maybe there are better ideas ;) 

Translate