Thing Presence
To address the broad range of devices that connect to the ThingWorx platform, the concept of "connected" has changed from "currently bound using a websocket" to "connection normalcy", which is referred to as Thing Presence. Thing Presence indicates when the connection of a Thing is "normal", based on the expected behavior of the device.
ThingWorx AlwaysOn devices (running a ThingWorx Edge SDK-based application or the ThingWorx Edge MicroServer) bind websockets. If not configured to be offline for a period of time, are always available to receive messages from the ThingWorx platform. Axeda eMessage Agent devices, on the other hand, poll the platform periodically ("ping") and can receive messages from the platform only when connected and bound. Both of these main types of devices are supported by Thing Presence.
Thing Presence is comparable across categories of devices and is supported by all ThingWorx interfaces. For example, a service organization might want to create a dashboard that indicates all devices that are available for service calls or all devices that are unexpectedly offline. Thing Presence is used by the ThingWorx SCM Extension to determine if a device is connected "normally" (by checking a property called isReporting), so that a package may be selected for and deployed to a device.
It is important to understand that Thing Presence does not attempt to diagnose the overall condition of a device. Thing Presence is presented as a singular Boolean property, which enables ThingWorx to provide a unified experience across the wide variety of assets.
How It Works
In the most general sense, any device that is defined as a RemoteThing has the following new attributes
Identifies whether a device is determined to be available for "normal" communications based on the applied "Reporting Strategy".
Identifies when the isReporting value was last changed.
Identifies when the last evaluation for isReporting occurred.
A Thing that defines the algorithm for determining if a device is reporting.
Evaluates if a device is reporting and sets the isReporting property accordingly.
Sets the strategy used for evaluating if a device is reporting.
Obtains the strategy currently used for evaluating if a device is reporting.
The exact algorithm for determining if a device is reporting depends on the specific ReportingStrategy Thing. However, the general process is as follows:
1. The EvaluateReporting service is triggered by some event
2. EvaluateReporting subsequently calls the ReportingAlgorithm service on the strategy Thing.
3. The ReportingAlgorithm returns a Boolean, based on the specific algorithm.
4. The isReporting property is set based on the results of the ReportingAlgorithm service.
The EvaluateReporting Service
The EvaluateReporting service takes the following parameters:
eventName — The name of the event that has caused the re-evaluation of the reporting state.
eventTime — The time when the event occurred.
source — The name of the Thing that generated the event.
sourceProperty — The source property of the event.
eventData — The data of the event.
All parameters of EvaluateReporting() are passed directly to ReportingStrategy.ReportingAlgorithm()
When this service is executed during a Thing bind or unbind:
The eventName is BindingEvent.
The eventData contains a single row with a single value under the isBound key, indicating whether the Thing has just been bound or unbound (true for bound, false for unbound).
If a problem occurs during this service (including in the ReportingAlgorithm), the Thing is updated to "not reporting", and a message is added in the ApplicationLog.
Was this helpful?