betelgeuse
betelgeuse

Reputation: 469

Create asset inactivity alarm in Thingsboard

I have a system where each device is connected to many sensors which monitors the temperature of different assets. So, I propagate the telemetry from the device to each related asset. That is fine. I also set up an inactivity alarm for the devices (following this). The device inactivity alarm triggers appropriately when a device becomes inactive.

Now, I am looking to establish an alarm for asset inactivity. Specifically, I want to trigger an alarm if a sensor becomes disconnected from its associated device, resulting in no data transmission to the asset for more than 15 minutes. In other words, I want to detect when the asset telemetry is not updated due to a sensor being disconnected. How can I implement this functionality?

Upvotes: 0

Views: 268

Answers (1)

andresrokp
andresrokp

Reputation: 81

You could use a Generator node as a pulse clock and then compare timestamps. The algoritm would be as follows:

  1. Set the Generator with your Asset as the originator and a short trigger period.
  2. Then feed a green OriginatorTelemetry node to load the last telemetry of that asset as a string in the metadata object.
  3. Feed a blue TransformationScript and/or a yellow FilterScript node.
  4. In the script, parse the ts in the metadata, take the difference with JS Date.now() and compare it with your desired time threshold (15min=900000ms)
  5. Handle as needed (Save timeseries, trigger alarm, email,...)

By the way, because it would be great to implement a more deep solution for this 'non-signals' events, in our company we have plans to include some hardware trigger for disconections in the future. This way, in case of a shut down in energy, a capacitor/battery/cell would release enough energy to send a msg with {isDisconected : true}.

Hope being of help.

Upvotes: 0

Related Questions