Device connection status - Standalone - Webhook

I have a device created as Standalone, and the data comes in via a webhook. However, the connection status of the device stays “unknown” all time.

  1. Does it require a workflow to change the “connection status” to connected/disconnected?
    Ideally, the device state would be automatically set to connected when a webhook comes in, and shows disconnected when not being active for a certain time.

  2. A last-time data-received timestamp would be great as well, but it seems I have overlooked that feature?

Thanks for any hints.

Hi @Frank12 !

Yes, you can use a workflow to set how device connection status behaves…

To set device status to “connected” every time it reports state:

Use a Device State Trigger followed by a Conditional Node to determine if the device is connected. If FALSE (left path), use the Losant API Node to set Device: Set Connection Status to connected.

To set device status to “disconnected” after a period of inactivity:

Use a Device: Inactive Trigger, configured to fire after a chosen interval of time, followed by a Conditional Node to determine if the device is connected. If TRUE (right path), use the Losant API Node to set Device: Set Connection Status to disconnected.

I agree that this should be easier. I’ll bring this up with our team and see what we can do. Thanks for the feedback!

What is the expression on the Conditional node ? The Device: State node does not have an “is_connected” boolean.

It looks like the device’s connection status is not on the initial payload for those triggers; I am filing a ticket to see if we can add it.

In the meantime, you will need to use a Device: Get Node to fetch the device that made the state report; assuming you store the result of that operation under the payload path working.device, you could then follow that up with a Conditional Node with an expression of:

{{working.device.connectionInfo.connected}} === 1

The true path means the device is connected; the false path means it is disconnected.