diff --git a/src/content/_includes/docs/edge/reference/configuration/rule-engine-config.mdx b/src/content/_includes/docs/edge/reference/configuration/rule-engine-config.mdx index 6d5a350931..3205e85589 100644 --- a/src/content/_includes/docs/edge/reference/configuration/rule-engine-config.mdx +++ b/src/content/_includes/docs/edge/reference/configuration/rule-engine-config.mdx @@ -271,7 +271,7 @@ All parameters listed here correspond to settings in `tb-edge.yml` (or `tb-edge. | Parameter | Env variable | Default | Description | |-----------|-------------|---------|-------------| -| `state.defaultInactivityTimeoutInSec` | `DEFAULT_INACTIVITY_TIMEOUT` | `600` | Device inactivity timeout is a global configuration parameter that defines when the device will be marked as "inactive" by the server. The parameter value is in seconds. A user can overwrite this parameter for an individual device by setting the “inactivityTimeout” server-side attribute (NOTE: expects value in milliseconds). We recommend this parameter to be in sync with session inactivity timeout ("transport.sessions.inactivity_timeout" or TB_TRANSPORT_SESSIONS_INACTIVITY_TIMEOUT) parameter which is responsible for detection of the stale device connection sessions. The value of the session inactivity timeout parameter should be greater or equal to the device inactivity timeout. Note that the session inactivity timeout is set in milliseconds while device inactivity timeout is in seconds. | +| `state.defaultInactivityTimeoutInSec` | `DEFAULT_INACTIVITY_TIMEOUT` | `600` | Global fallback for device inactivity detection, in seconds. ThingsBoard resolves a device's inactivity timeout in this order: per-device `inactivityTimeout` server-side attribute (milliseconds), then the device profile's **Device inactivity timeout** field, then this global value. Keep this parameter in sync with the session inactivity timeout (`transport.sessions.inactivity_timeout` or `TB_TRANSPORT_SESSIONS_INACTIVITY_TIMEOUT`), which controls stale transport sessions. The session inactivity timeout should be greater than or equal to the device inactivity timeout. The session inactivity timeout is in milliseconds; the device inactivity timeout is in seconds. | | `state.defaultStateCheckIntervalInSec` | `DEFAULT_STATE_CHECK_INTERVAL` | `60` | Interval for checking the device state after a specified period. Time in seconds | | `state.persistToTelemetry` | `PERSIST_STATE_TO_TELEMETRY` | `false` | Controls whether we store the device 'active' flag in attributes (default) or telemetry. If you decide to change this parameter, you should re-create the device info view as one of the following: If 'persistToTelemetry' is changed from 'false' to 'true': 'CREATE OR REPLACE VIEW device_info_view AS SELECT * FROM device_info_active_ts_view;' If 'persistToTelemetry' is changed from 'true' to 'false': 'CREATE OR REPLACE VIEW device_info_view AS SELECT * FROM device_info_active_attribute_view;' | | `state.telemetryTtl` | `STATE_TELEMETRY_TTL` | `0` | Millisecond value defining time-to-live for device state telemetry data (e.g. 'active', 'lastActivityTime'). Used only when state.persistToTelemetry is set to 'true' and Cassandra is used for timeseries data. 0 means time-to-live mechanism is disabled. | diff --git a/src/content/_includes/docs/recipes/device-inactivity-alarm.mdx b/src/content/_includes/docs/recipes/device-inactivity-alarm.mdx index a893ae2e03..97d65bba30 100644 --- a/src/content/_includes/docs/recipes/device-inactivity-alarm.mdx +++ b/src/content/_includes/docs/recipes/device-inactivity-alarm.mdx @@ -311,13 +311,21 @@ The Rule Engine processes - The `inactivityTimeout` server-side attribute on an individual device (in milliseconds) overrides `DEFAULT_INACTIVITY_TIMEOUT` for that device only. + ThingsBoard resolves a device's inactivity timeout in this order: + 1. The `inactivityTimeout` server-side attribute on the device (milliseconds), if set. + 2. The **Device inactivity timeout** field on the device's profile, if set. + 3. The global `DEFAULT_INACTIVITY_TIMEOUT` fallback (seconds). + + See device profile inactivity settings for the profile-level field. ## Connectivity Events @@ -40,7 +45,7 @@ The Device State service fires four event types into the Rule Engine, each mappe ## Inactivity Detection -A device is marked **inactive** when no activity is received for `DEFAULT_INACTIVITY_TIMEOUT` seconds (default: 600 s / 10 minutes). ThingsBoard checks all devices on a schedule controlled by `DEFAULT_STATE_CHECK_INTERVAL` (default: 60 s). +A device is marked **inactive** when no activity is received within its effective inactivity timeout. ThingsBoard resolves the value per device in this order: per-device `inactivityTimeout` server attribute (milliseconds), then the device profile's **Device inactivity timeout** field, then the global `DEFAULT_INACTIVITY_TIMEOUT` (seconds, default 600 s / 10 minutes). ThingsBoard checks all devices on a schedule controlled by `DEFAULT_STATE_CHECK_INTERVAL` (default: 60 s). **Transport session vs device inactivity** — these are separate timeouts: - `DEFAULT_INACTIVITY_TIMEOUT` — when the Device State service marks a device inactive @@ -125,7 +130,7 @@ Time is divided into consecutive **reporting periods** of fixed length (controll TB_TRANSPORT_SESSIONS_INACTIVITY_TIMEOUT - 300000 + 600000 Milliseconds before an idle transport session is closed diff --git a/src/content/_includes/docs/user-guide/device-profiles.mdx b/src/content/_includes/docs/user-guide/device-profiles.mdx index 84b342def2..8987621591 100644 --- a/src/content/_includes/docs/user-guide/device-profiles.mdx +++ b/src/content/_includes/docs/user-guide/device-profiles.mdx @@ -33,7 +33,7 @@ Clicking a profile opens a details panel with the following tabs: | Tab | Contents | |-----|---------| -| **Details** | Profile name, default dashboard, rule chain, firmware and software version | +| **Details** | Profile name, default dashboard, rule chain, firmware and software version, device inactivity timeout | | Transport Configuration | Protocol-specific settings: authentication, payload format, topic filters | | Calculated Fields | Formulas for computing derived metrics from device telemetry or attributes | | Alarm Rules | Conditions, severity levels, and actions applied to all devices in this profile | @@ -67,3 +67,16 @@ Define conditions that apply to all devices in this profile — for example, tri ### Provisioning Control how new devices are created and authenticated when they first connect. See Provisioning. + +### Device inactivity timeout + +Set how long a device may be silent before ThingsBoard marks it inactive. Choose the unit from the dropdown (seconds, minutes, hours, or days). Leave the field empty or set it to 0 to fall back to the global `DEFAULT_INACTIVITY_TIMEOUT` setting. + +The profile-level value applies to every device in the profile, unless a device has its own `inactivityTimeout` server attribute, which always takes priority. + +Resolution order at runtime: +1. Per-device `inactivityTimeout` server attribute (milliseconds), if set. +2. **Device inactivity timeout** field on this profile, if set. +3. Global `DEFAULT_INACTIVITY_TIMEOUT` fallback (seconds, default 600). + +Updating the profile value propagates to all assigned devices without a restart. See device connectivity status for how inactivity is detected and reported.