Device Connection Status - SelfOffline
This page provides information about the SelfOffline status for sensor devices.
SelfOffline is a status that indicates a device has intentionally disconnected from the cloud and missed the keep-alive packets. Battery-operated sensor devices often go into a sleep mode to conserve battery.
How it Works
- When you assign a
Sensor
type template to a device, it is automatically enabled for SelfOffline status. - The
sync_freq
field in the template determines the duration for which a sensor device stays in SelfOffline status before being marked Offline. This value is in seconds and controls the device's sleep cycle.- If
sync_freq
is set to 0, the device will skip SelfOffline and go directly to Offline.
Please refer Create Template API.
- If
- Cloud monitors the value set in
sync_freq
of the sensor device and accordingly sets it to Offline.- If the sleep duration is crossed and the status of the device has not changed to Online (i.e. the device does not wake up and connect to the Cloud), the scheduler marks such devices Offline.
- Device must ensure (and implement the required logic for) waking up and connecting to the Cloud after its sleep duration is completed. At this time, device should be able to consume all the pending commands (if any).
- SelfOffline works for both HTTP and MQTT.
Status Definitions
SelfOffline: If the device misses 3 consecutive keep-alive packets, it will be marked SelfOffline.
Offline: If the device does not wake up after the sleep duration (based on the value set in sync_freq), it will be marked Offline.
Online: If the device wakes up and sends keep-alive packets after the sleep duration, it will be marked Online, and the regular KA packet processing will resume.
Note: The sync_freq
value in the template should not be updated. If it needs to be changed, create a new template and assign it to the device.
You can access the device status at any time using the Get Connection History API.
Updated 12 days ago