TapHome Icon

Multi-line scripting language with syntax highlighting, usable in smart rules Equation, Formula and Script, and also in Modbus and Packet parser interfaces.

Syntax Highlighting Example

Reference

The script language reference is organized into the following pages:

  • Basics — association, multi-line algorithms, returned value, temporary variables, IF/ELSEIF/ELSE, SWITCH, loops, NaN, ISNULL, SLEEP, comments, numeric literals (hexadecimal and binary), and mathematical/logical expressions and operators.
  • Interpolation and thresholds — LINEAR (linear interpolation) and HYSTERESIS (threshold-based signal filtering).
  • Mathematical functions — MIN, MAX, AVG (and their STRICT variants), ROUND, ABS, DEWPOINT, POWER, MOD, CEIL, FLOOR, RAND, RANDINT, SIGN, SQRT, LOG, LN.
  • Bit operations — GETBIT, GETBITS, GETBYTE, SETBYTE, SETBIT, SETBITS, bit shifts, and bitwise AND/OR.
  • Text, String and Byte array — LENGTH, BYTECOLLECTION, INDEXOF, COPY, REPLACE, SPLIT, COMPARE, APPEND, INSERT, REMOVEAT, GETAT, SETAT, ENCODE, DECODE, EQUALS.
  • Sorting — ORDER, ORDERINDEX and their STRICT and descending variants.
  • Date and time — DATETIME, NOW, TIMESPAN, LOCALTIMEZONE, DATETIMEADD.
  • Data type conversions — TODOUBLE, TOSTRING, TOBCD, FROMBCD, TOBYTEARRAY, RGBTOHSV, HSVTORGB.
  • Parsing functions — PARSETEXT, PARSEJSON, PARSEXML.
  • Packet parser — SENDHTTPREQUEST, SENDDATA, MQTTPUBLISH, FTPDOWNLOAD, FTPUPLOAD, COMPLETESERVICEATTRIBUTE, COMPLETESERVICEACTION, plus Modbus.