{
  "schemaVersion": 1,
  "snapshotDate": "2026-10-23",
  "slug": "reference-app-core-type-device-reading",
  "title": "Device reading",
  "section": "Library asset reference",
  "description": "A validated reading from a monitoring device.",
  "kind": "type",
  "url": "/wiki/reference-app-core-type-device-reading/",
  "markdown": "/wiki/reference-app-core-type-device-reading/index.md",
  "json": "/wiki/reference-app-core-type-device-reading/index.json",
  "headings": [
    {
      "id": "fields",
      "title": "Fields",
      "depth": 2
    },
    {
      "id": "example",
      "title": "Example",
      "depth": 2
    },
    {
      "id": "using-and-testing",
      "title": "Using and testing",
      "depth": 2
    },
    {
      "id": "catalog-identity",
      "title": "Catalog identity",
      "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.type.device-reading",
    "slug": "app-core-type-device-reading",
    "name": "Device reading",
    "kind": "type",
    "family": "app-core",
    "packId": null,
    "category": "Domain types",
    "description": "A validated reading from a monitoring device.",
    "inputs": [],
    "outputs": [],
    "configSchema": {},
    "documentation": "# Device reading\n\nA reusable JSON Schema contract for a normalized monitoring measurement. It validates values at typed sockets; it does not fetch readings, coerce payloads, convert units or run code.\n\n## Fields\n- **deviceId** (required string): at least one character.\n- **value** (required number): measurement magnitude, without a minimum/maximum.\n- **unit** (required string): unit label.\n- **timestamp** (required string): timestamp representation.\n- Additional properties are rejected.\n\n## Example\n`{\"deviceId\":\"meter-example\",\"value\":12.5,\"unit\":\"kW\",\"timestamp\":\"2026-01-01T12:00:00.000Z\"}`\n\nThis passes the declared shape. A quoted value `\"12.5\"`, missing unit, empty deviceId or extra property is invalid. The schema does not apply a timestamp format, unit enum or nonempty rule to unit/timestamp; strings accepted by this version need not represent a valid date or recognized engineering unit. Add stricter constraints in a deliberately versioned type when required.\n\n## Using and testing\nChoose this custom type on an input/output socket. A custom socket pins the type's definition ID and version; matching IDs at different versions do not connect automatically. A typed reading can feed an ordinary object input; an arbitrary object output does not establish this contract in the graph. In the type test bench, wrap the candidate as `{\"value\": <reading>}`.\n\nNo sockets, configuration, control routes, state or I/O belong to the type itself. Publishing preserves older schemas and their existing users. The Read device payload demo constructs values of this shape, while Compose alert consumes them. Domain identities and measurement contents remain ordinary workflow/run data.",
    "schema": {
      "type": "object",
      "properties": {
        "deviceId": {
          "type": "string",
          "minLength": 1
        },
        "value": {
          "type": "number"
        },
        "unit": {
          "type": "string"
        },
        "timestamp": {
          "type": "string"
        }
      },
      "required": [
        "deviceId",
        "value",
        "unit",
        "timestamp"
      ],
      "additionalProperties": false
    },
    "tags": [
      "builtin",
      "type"
    ],
    "source": "app-builtin-catalog"
  }
}
