Expressions
Templates resolve data with {moduleId:property} expressions
and pipe the result through transforms for formatting and
arithmetic. Transforms compose left to right:
{wx:temperature | round:0 | c2f} → "73"
{dt:hour | towords | uppercase} → "FOURTEEN"
{sys:battery | gte:80} → "true" Pipe transforms (28)
| Name | Syntax | Description | Example | Argument |
|---|---|---|---|---|
add | value | add:addend | Add a number to the value | 10 → 15 (with add:5) | addend — number to add |
c2f | value | c2f | Convert Celsius to Fahrenheit | 0 → 32 | — |
c2k | value | c2k | Convert Celsius to Kelvin | 0 → 273.2 | — |
capitalize | value | capitalize | Capitalize the first character | hello → Hello | — |
ceil | value | ceil | Round up to the nearest integer | 3.1 → 4 | — |
clamp | value | clamp:min:max | Constrain value to a min/max range | 150 → 100 (with clamp:0:100) | min:max — lower and upper bounds |
f2c | value | f2c | Convert Fahrenheit to Celsius | 76 → 24.4 | — |
f2k | value | f2k | Convert Fahrenheit to Kelvin | 32 → 273.2 | — |
floor | value | floor | Round down to the nearest integer | 3.9 → 3 | — |
gte | value | gte:threshold | Check if value is greater than or equal to threshold | 85 → true (with gte:80) | threshold — comparison value |
k2c | value | k2c | Convert Kelvin to Celsius | 273.15 → 0 | — |
k2f | value | k2f | Convert Kelvin to Fahrenheit | 273.15 → 32 | — |
lowercase | value | lowercase | Convert text to lowercase | AM → am | — |
lte | value | lte:threshold | Check if value is less than or equal to threshold | 70 → true (with lte:80) | threshold — comparison value |
multiply | value | multiply:factor | Multiply by a factor | 10 → 20 (with multiply:2) | factor — number to multiply by |
ordinal | value | ordinal | Convert a number to ordinal form | 3 → 3rd | — |
padend | value | padend:N | Pad from the end with zeros | 5 → 50 | N = target length (default 2) |
padstart | value | padstart:N | Pad from the start with zeros | 5 → 05 | N = target length (default 2) |
replace | value | replace:old:new | Replace occurrences of a substring | hello → heLLo (with replace:l:L) | old:new — string to find and replacement |
round | value | round:N | Round to a number of decimal places | 3.456 → 3.5 (with round:1) | N = decimal places (default 0) |
scale | value | scale:inMin:inMax:outMin:outMax | Linear interpolation between input and output ranges | 50 → 0.5 (with scale:0:100:0:1) | inMin:inMax:outMin:outMax — source and target ranges |
substr | value | substr:start:end | Extract a substring by index range | hello → el (with substr:1:3) | start:end — zero-based indices |
ternary | value | ternary:trueVal:falseVal | Conditional output based on true/false value | true → yes (with ternary:yes:no) | trueVal:falseVal — output for true and false |
tocelsius | value | tocelsius:UNIT | Convert any temperature to Celsius | 76 → 24.4 (with tocelsius:F) | UNIT — source unit: C, F, or K |
tofahrenheit | value | tofahrenheit:UNIT | Convert any temperature to Fahrenheit | 0 → 32 (with tofahrenheit:C) | UNIT — source unit: C, F, or K |
tokelvin | value | tokelvin:UNIT | Convert any temperature to Kelvin | 32 → 273.2 (with tokelvin:F) | UNIT — source unit: C, F, or K |
towords | value | towords | Convert a number to English words | 14 → fourteen | — |
uppercase | value | uppercase | Convert text to UPPERCASE | am → AM | — |