Skip to main content

Inputs and Outputs

Inputs and outputs are the communication contract between a skill and the rest of the platform. Inputs carry configuration into the container via the Azure IoT module twin. Outputs carry data out of the container at runtime.


Inputs

Inputs are user-configurable fields defined on a skill version. When someone adds a skill to a workflow, they fill in values for each input. Those values are delivered to the device through the Azure IoT module twin desired settings. The skill container reads these values using the Azure IoT device SDK.

This means the same skill can be deployed to multiple workflows with different configurations — for example, different API keys, detection thresholds, or server addresses — without building a separate container for each.

Input fields

Each input has the following properties:

PropertyDescription
Input KeyThe field name within the inputs object of the Azure IoT module twin desired properties (desired.inputs.<key>). The skill reads this key from the twin using the Azure IoT device SDK.
Input LabelThe human-readable name shown in the portal when a workflow is configured. Should describe what the value is for.
Field TypeControls how the value is entered in the portal. See field types below.

Field types

Text

A single-line text input. Use this for short values like server addresses, identifiers, or numeric thresholds.

Password

A masked field — the value is hidden in the portal UI. Use this for any sensitive value: API keys, access tokens, passwords, or secrets.

tip

Always use the Password type for credentials and API keys. This masks the value in the portal and signals to workflow editors that the field contains sensitive data.

How inputs are used in a workflow

When a skill is added to a workflow, the Workflow Skill configuration screen shows each input with its label and field type. The person setting up the workflow enters the value for each input. These values are stored and, when the workflow is synced, delivered to the device via the Azure IoT module twin desired settings.


Outputs

Outputs are named data fields that the skill container emits at runtime. They appear in the portal as live data from your devices, and they power actions like email alerts, API calls, and charts.

When a skill emits a data record, it sends a JSON payload as an Azure IoT message through the Azure IoT infrastructure. The output key defines which field in that payload this output corresponds to — for example, an output with key count will read the value at data.count in the emitted message. All outputs are automatically tracked via charting, see Charts for details.

Output fields

PropertyDescription
Output KeyThe field name in the Azure IoT message payload emitted by the skill. For example, spacesOccupied reads data.spacesOccupied from the IoT message.
Output LabelThe human-readable name shown in the portal, workflow configuration, and charts.
Data TypeDeclares the type of the emitted value: String, Number, or Boolean.
Unhealthy AfterOptional. If no output is received from the skill within this duration, the skill is flagged as unhealthy on that device. Minimum 1 minute, maximum 11 hours.

Data types

String

Use for text values: status messages, labels, identifiers, or any free-form text.

Number

Use for numeric values: counts, measurements, percentages, temperatures, confidence scores. Number outputs support status mapping (see below).

Boolean

Use for binary state: on/off, pass/fail, detected/not-detected. Boolean outputs support status mapping (see below).

Default outputs

Every skill version automatically exposes a set of platform-provided outputs regardless of what you define. These are always available in the portal, charts, and actions:

Output KeyLabelDescription
createdAtCreated AtTimestamp when the output record was created
deviceIdDevice IDThe unique ID of the device that emitted the output
workflowSkillIdSkill IDThe ID of the workflow skill instance
serialNumberSerial NumberThe device serial number
deviceNameDevice NameThe display name of the device
latitudeLatitudeGPS latitude of the device (if available)
longitudeLongitudeGPS longitude of the device (if available)

Status mapping

Status mapping lets you configure automatic health color-coding for Number and Boolean outputs. When enabled, the portal colors the output value green, yellow, or red based on the thresholds you define.

This is useful for at-a-glance monitoring — for example, turning a count green when it is within a normal range and red when it exceeds a threshold.

Status mapping for Number outputs

For numeric outputs, you define two threshold values and a direction:

  • Lower threshold — The boundary between the red/yellow zones
  • Upper threshold — The boundary between the yellow/green zones
  • Direction — Controls which end of the scale is healthy:
    • asc (higher is better) — values above the upper threshold are green, below the lower threshold are red
    • desc (lower is better) — values below the lower threshold are green, above the upper threshold are red

Example: A parking space occupancy count where lower is better:

  • Lower threshold: 10
  • Upper threshold: 20
  • Direction: desc (fewer spaces occupied is healthier)
  • Result: < 10 = green, 10–20 = yellow, > 20 = red

Status mapping for Boolean outputs

For boolean outputs, the mapping is fixed:

  • false = red (unhealthy)
  • true = green (healthy)

This is appropriate for outputs like detected or connected where true represents the desired state.

Enabling status mapping

When creating or editing an output, set the Data Type to Number or Boolean, then click Enable Status to reveal the threshold configuration. Click Disable Status to remove the mapping.

note

Status mapping is only available for Number and Boolean data types. String outputs do not support thresholds.


Managing outputs across workflows

You can selectively disable individual outputs within a specific workflow without removing them from the skill definition. This is useful when a skill produces many outputs but a particular workflow only needs a subset.

To disable an output in a workflow, open the workflow skill configuration and toggle off any outputs you don't need. Disabled outputs are still defined on the skill version — they just won't be processed by that workflow's actions.


Building skills that use inputs and outputs

For working code examples showing how to read inputs from the Azure IoT module twin and send outputs as Azure IoT messages, see the example-optra-skills repository. It includes a reference implementation demonstrating the Azure IoT device SDK integration patterns used by the platform.