Skip to main content

Environment Variables

Environment variables are key-value pairs that are injected into every skill container running on a device. They allow skills to access device identity, configuration, and portal information at runtime without hardcoding those values into the skill image.


How environment variables work​

There are two types of environment variables on Optra Edge devices:

  1. System variables — Automatically provided by the portal for every device. These are read-only and always present.
  2. Custom variables — Defined by you in the device Settings tab (or at the skill level). These override skill-level variables when the same key is used at both levels.

Override priority (highest to lowest):

Device-level custom variables → Skill-level variables → System defaults

System environment variables​

The following variables are automatically injected into every skill on the device. You do not need to define these — they are always available.

VariableDescription
OPTRA_SERIAL_NUMBERThe device's 13-character serial number (uppercase)
OPTRA_DEVICE_IDThe IoT module device ID used by the portal
OPTRA_DEVICE_NAMEThe device's display name as configured in the portal
OPTRA_DEVICE_MODELThe device model identifier (e.g., vz6100, cx2000)
OPTRA_DEVICE_FIRMWARE_VERSIONThe firmware version currently running on the device
OPTRA_DEVICE_IPThe device's current IP address
OPTRA_DEVICE_MACThe device's MAC address
OPTRA_DEVICE_SIGNATUREA device-specific signature string
OPTRA_DEVICE_TIMEZONEThe timezone of the device's assigned location (e.g., America/New_York). Defaults to UTC if no location is set.
OPTRA_API_URLThe Optra portal API endpoint URL
TZSame value as OPTRA_DEVICE_TIMEZONE. Sets the system timezone for the container.

Custom environment variables​

You can define custom key-value pairs to pass additional configuration to your skills. These are set in the Settings tab of the device detail view.

Adding custom variables​

  1. Open the device detail view and click the Settings tab.
  2. Scroll to the Environment Variables section.
  3. Add a key and value for each variable.
  4. Click Save.

Key restrictions​

Custom environment variable keys must follow these rules:

  • Must not contain . (period)
  • Must not contain $ (dollar sign)
  • Must not contain # (hash)
  • Must not contain spaces

Invalid characters are rejected when you save.

Use cases​

Use caseExample
Point a skill to a local resourceAPI_ENDPOINT=http://192.168.1.50:8080
Override a skill defaultDETECTION_THRESHOLD=0.75
Pass site-specific metadataSITE_NAME=Warehouse-A
Configure a skill connection stringMQTT_BROKER=mqtt://broker.local:1883
tip

If the same variable key is defined both at the device level and at the skill level, the device-level value takes precedence. This makes device-level variables useful for site-specific overrides of shared skill configurations.


Environment variables vs. skill inputs​

Skill inputs are the preferred way to configure a skill when the configuration is workflow-specific. Use device-level environment variables when:

  • You need a value to apply to all skills on a device, not just one.
  • The value is device-specific (e.g., a local IP address or a site code).
  • You want to override a skill's default without modifying the skill or workflow configuration.