Skip to content
Stand with Ukraine flag

Device State

Use this node to programmatically trigger device connectivity events for the message originator — for example, recording a connect event when a custom integration reports that a device has come online, or triggering an inactivity event to mark a device offline after a watchdog timeout. Rate limiting prevents event flooding per device.

  • Device connectivity event — required. The type of event to trigger:
EventKey UpdatedMessage Type SentActivity Status
Connect EventlastConnectTimeCONNECT_EVENT to default rule chainNo change
Activity EventlastActivityTimeACTIVITY_EVENT (only if status changes false→true)Set to true
Disconnect EventlastDisconnectTimeDISCONNECT_EVENT to default rule chainNo change
Inactivity EventlastInactivityAlarmTimeINACTIVITY_EVENT to default rule chainSet to false

Rate limiting per device is controlled by the DEVICE_STATE_NODE_RATE_LIMIT_CONFIGURATION environment variable (default: 1:1,30:60,60:3600 — 1 event/second, 30 events/minute, 60 events/hour).

If the incoming message metadata contains a ts key, that timestamp is used as the event timestamp; otherwise the message timestamp is used.

  1. Verify that the originator is a DEVICE. If not, route via Failure.
  2. Apply rate limiting per device. If the limit is exceeded, route via Rate limited.
  3. Determine the event timestamp from metadata ts key or message timestamp.
  4. Trigger the configured connectivity event, updating the appropriate timestamp key and sending a lifecycle message to the device’s default rule chain.
  5. Route the original message via Success.
ConnectionCondition
SuccessEvent triggered successfully.
FailureOriginator is not a DEVICE, or unexpected error.
Rate limitedPer-device rate limit exceeded.

Originator: device (currently inactive) | Metadata: { "ts": "1694887200000" }

{ "event": "ACTIVITY_EVENT" }

Result: lastActivityTime updated to 1694887200000, activity status changes falsetrue, ACTIVITY_EVENT message sent to device’s default rule chain. Original message routes via Success.

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "TbDeviceStateNodeConfiguration",
"type": "object",
"additionalProperties": false,
"properties": {
"event": {
"type": "string",
"enum": ["CONNECT_EVENT", "ACTIVITY_EVENT", "DISCONNECT_EVENT", "INACTIVITY_EVENT"]
}
}
}