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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Events and Subscriptions for Timers and Schedulers

No ratings

Events

 

  • Timers and Schedulers both come with a specific Event inherited from the Thing Template:
    • Timer
    • ScheduledEvent
  • Both have a Data Shape allowing to capture the timestamp of when the Event was actually fired.
  • Events in ThingWorx are triggered when a specific condition is met. In this context the condition is met and the Event is fired when a Timer has expired or a Scheduler's time is reached.
  • Once an Event is triggered, Subscriptions will take care of executing custom Services to react to the Event.

Subscriptions

 

  • Subscriptions listen to Events and can be used to react to certain Events with running custom Service scripts.
  • To follow-up on Timers and Schedulers, a new Subscription must be created, listening to any related Event fired.
  • Add a new Subscription to the Thing with

 

 image

 

  • As the Subscription is usually listening to the Thing that it is configured on, the Source has to be left empty. When listening to other Entities' Subscriptions the corresponding Entity can be picked in the Source Entity picker.
  • Ensure to check the Enabled checkbox to actually enable the Subscription and allow it for executing code in the Script area.
  • The following Script will log into the ScriptLog once the Timer Event is fired

 

image

 

  • The following Script will log into the ScriptLog once the ScheduledEvent Event is fired

 image

Comments

What should be Input/Output in a subscription?

Version history
Last update:
‎Mar 01, 2018 09:57 AM
Updated by: