Pages

Output Script

What is Output Script?

Output Script is a flexible output element that lets you modify or calculate data before it’s shown in the UI.
You write your own JavaScript logic to transform live values from a connected source or create entirely new output based on conditions, rules, or expressions.

This allows for custom formatting, unit conversion, conditional display, and much more — all in real time.

Key Features

  • Uses your own JavaScript logic
  • Works with one or more connected input values
  • Output is calculated or formatted before display
  • Ideal for complex display needs (e.g. “if temperature > 50 → show ‘HOT’”)

When should you use it?

Use Output Script when:

  • You need to format, filter, or calculate values before showing them
  • You want to display logic-based messages (e.g. system status based on rules)
  • You work with non-standard units, conversions, or combined values
  • You want maximum control over the output content

Practical Examples

  1. Simple Value Formatting
    Use Case: Round a numerical input to one decimal and add unit °C.
return value.toFixed(1) + " °C";

What it does:
If the input is 23.678, the output will be 23.7 °C.


  1. Conditional Output
    Use Case: Show a warning message if value exceeds threshold.
[code_block_1]

What it does:
Displays ⚠️ High Load! if the value is above 80, otherwise shows Normal.


  1. Convert Units (e.g., Celsius to Fahrenheit)
[code_block_2]

What it does:
Transforms a temperature value from Celsius to Fahrenheit and adds unit.


  1. Custom Logic with Multiple Inputs
    Scenario: You have two connected inputs: voltage and current. You want to calculate and display power.
[code_block_3]

Note: You must configure the input mapping properly so that voltage and current are accessible by name.


  1. Time Formatting from Seconds
    Use Case: Convert seconds into MM:SS format.
[code_block_4]

What it does:
If input is 135, output will be 2:15.


Advantages

  • Extremely powerful and flexible
  • Works in real-time
  • Can output text, numbers, or formatted messages

Limitations

  • Requires basic understanding of JavaScript
  • Purely for display – not interactive
return value.toFixed(1) + " °C";