{
  "schemaVersion": 1,
  "snapshotDate": "2026-10-23",
  "slug": "reference-app-core-demo-reading",
  "title": "Read device payload",
  "section": "Library asset reference",
  "description": "Normalises the trigger payload into a validated Device reading.",
  "kind": "node",
  "url": "/wiki/reference-app-core-demo-reading/",
  "markdown": "/wiki/reference-app-core-demo-reading/index.md",
  "json": "/wiki/reference-app-core-demo-reading/index.json",
  "headings": [
    {
      "id": "sockets-and-defaults",
      "title": "Sockets and defaults",
      "depth": 2
    },
    {
      "id": "example",
      "title": "Example",
      "depth": 2
    },
    {
      "id": "catalog-identity",
      "title": "Catalog identity",
      "depth": 2
    },
    {
      "id": "inputs",
      "title": "Inputs",
      "depth": 2
    },
    {
      "id": "outputs",
      "title": "Outputs",
      "depth": 2
    },
    {
      "id": "configuration-schema",
      "title": "Configuration schema",
      "depth": 2
    },
    {
      "id": "source-and-installed-versions",
      "title": "Source and installed versions",
      "depth": 2
    }
  ],
  "sources": [
    "../OpenNodeFlow-Library/work/catalog-all.mjs",
    "../OpenNodeFlow-Library/work/azure-pack-consolidation-20261022/catalog-policy.mjs",
    "../OpenNodeFlow-Library/work/developer-packs-20261022/catalog.mjs",
    "shared/seed.ts",
    "shared/storage-library.ts",
    "shared/variable-library.ts",
    "shared/control-flow.ts",
    "shared/remote-routes.ts",
    "server/runtime-library.ts",
    "shared/error-library.ts",
    "shared/storage-model.ts",
    "shared/builtin-documentation.ts"
  ],
  "family": "app-core",
  "contract": {
    "key": "app.core.demo.reading",
    "slug": "app-core-demo-reading",
    "name": "Read device payload",
    "kind": "node",
    "family": "app-core",
    "packId": null,
    "category": "Monitoring",
    "description": "Normalises the trigger payload into a validated Device reading.",
    "inputs": [
      {
        "id": "exec",
        "name": "Execute",
        "type": "control",
        "typeName": "Control",
        "required": false
      },
      {
        "id": "payload",
        "name": "Payload",
        "type": "object",
        "typeName": "Object",
        "required": true
      }
    ],
    "outputs": [
      {
        "id": "next",
        "name": "Next",
        "type": "control",
        "typeName": "Control",
        "required": false
      },
      {
        "id": "reading",
        "name": "Reading",
        "type": "type.device-reading",
        "typeName": "Device reading",
        "typeKey": "app.core.type.device-reading",
        "required": false
      },
      {
        "id": "value",
        "name": "Value",
        "type": "number",
        "typeName": "Number",
        "required": false
      }
    ],
    "configSchema": {},
    "documentation": "# Read device payload\n\nConverts an incoming object into the demo Device reading shape and exposes its numeric value separately. It is a normalization example, not a connection to physical equipment or a live monitoring API.\n\n## Sockets and defaults\n- **exec** (control): optional execution gate.\n- **payload** (object, required): source fields.\n- **reading** (Device reading custom type): deviceId, numeric value, unit and a freshly generated ISO timestamp.\n- **value** (number): the same normalized measurement magnitude.\n- **next** (control): automatic success route. No configuration schema.\n\ndeviceId uses String(payload.deviceId || \"meter-01\"); unit uses String(payload.unit || \"kW\"). Thus empty/falsy values use those demo fallbacks. value uses Number(payload.value ?? 87.4), preserving a supplied numeric zero. timestamp is execution time; an incoming timestamp is not copied. Unknown payload fields are not included in the reading.\n\n## Example\nInput `{\"deviceId\":\"meter-example\",\"value\":95,\"unit\":\"kW\"}` produces a reading with that identity/value/unit and a current timestamp, plus value 95. Even an empty object creates the demo default reading; do not confuse that fallback with a real acquired measurement.\n\nThe selected executor is Instrumented executor, adding timing logs. The body logs measurement, unit and device identity. There is no external fetch, secret read or checkpoint write. Bad numeric conversions fail runtime output validation; this asset has no error control route. Connect value to a threshold Condition and reading to Compose alert, with the desired control route gating the alert. Custom type and executor versions are pinned by definition publication.",
    "tags": [
      "builtin",
      "node"
    ],
    "source": "app-builtin-catalog"
  }
}
