reachthingsDocs
EN
Dashboard
Read toolsget_device_state
On this page
TOOLscope: devices:read · readOnlyHint

get_device_state

Returns the latest known values for the attributes this connection may read. Each value carries observed_at (when the manufacturer observed it), received_at (when Reachthings last fetched it) and fresh. Values older than max_age_ms are re-read once from the connector; if that read fails the stored value is returned with fresh: false and a connector_error. Values are observations; to check a command's result use get_command_status.

Arguments

device_idstringrequired

From list_devices.

attributesstring[]

Attribute ids to read (see the catalog). Defaults to every readable attribute of the device.

max_age_msinteger

Values older than this are refreshed from the manufacturer. Default 60,000.

Returns

attributes[].valueany | null

null when the device has never reported it.

attributes[].observed_at · received_at · fresh

Manufacturer observation time, last fetch time, and whether it is within max_age_ms.

checked_atstring

When this call ran.

connector_errorobject

Present when a refresh failed (vehicle asleep, manufacturer rate limit, …): code, retryable.

Request

REQUESTTypeScript ▾
await client.callTool({
  name: "get_device_state",
  arguments: { device_id: "dev_8kq2", attributes: ["power", "current_temperature"], max_age_ms: 30000 }
});
RESPONSE · structuredContent
{
  "device_id": "dev_8kq2",
  "attributes": [
    { "attribute": "power", "value": "on", "source": "manufacturer_state", "observed_at": "2026-11-01T09:12:04.000Z", "received_at": "2026-11-01T09:12:05.210Z", "fresh": true },
    { "attribute": "current_temperature", "value": 23.5, "source": "manufacturer_state", "observed_at": "2026-11-01T09:12:04.000Z", "received_at": "2026-11-01T09:12:05.210Z", "fresh": true }
  ],
  "checked_at": "2026-11-01T09:12:05.210Z"
}

Errors

Errors before a command is created return isError: true with command_id: null. Problems after creation are a command status, not an error. Full list: Errors.

CodeWhenWhat to do
DEVICE_NOT_ACCESSIBLEUnknown device, or not granted to this agentCall list_devices; ask the user to grant access
DEVICE_NOT_ACCESSIBLE
WhenUnknown device, or not granted to this agent
What to doCall list_devices; ask the user to grant access