Expressions are widely used by Big6 plug-in (see Profiles description, as well as Output links here). While the general theory of Regular Expressions is quite complex for the typical HS4 user, the examples below cover most of use cases. Feel free to ask for help at HS4 Big6 Forum if you need something beyond that. Furthermore you will find an Expression SandBox in Big6 Configuration page in HS4. It is highly recommended to test any expression that you create in the SandBox before plugging it into Big6.

IMPORTANT ! Always strip the wrap ${ } from the expression and enter the body only in Big6 profiles. However you keep it in Big6 actions and when using the sandbox.

IMPORTANT ! Please use straight quotes ” ONLY. Curly quotes exist that are left (beginning) and right (end). Those break Big 6 never use them. Unfortunately, if you copy from this screen than you’ll get the wrong quote characters (beyond our control) so you need to replace all quote characters.

IMPORTANT ! Big6 allows multiple expressions to be used in the profiles for processing multiple parameters. Multiple expressions are separated by && or &&& separators. Separators are not part of the expression for the purpose of testing it in the sandbox.

RegEx information for advanced users is available here

Example Input Expression Result
Use device value (device reference id = 123) The temperature is ${ val123 }°F outside The temperature is 71.6°F outside
Use device string (device reference id = 123) The last chat message was ‘${ str123 }’. The last chat message was ‘Hello world’.
Use Global Variable (GV) value (GV name=global1 for example) ${GVval(“global1”)}returns number
Use Global Variable (GV) string (GV name=global1 for example) ${GVstr(“global1”)}returns string
Calculations The temp ${ val123 }°F is ${ (val123 – 32)*(9.0/5.0) }°C The temperature 71.6°F is 22°C
Math operations ${ sin(90) + ceiling(100.3) * floor(13.9) + round(14.4) } 1328
Send out hex values${Hex(“41 31 0D”)}A1\r (works for Serial, MQTT and TCP profiles only)
Parsing string to number 30.5 The string ${ input } can be interpreted as number to calculate: ${ ParseNumber(input) + 100 } The string 30.5 can be interpreted as number to calculate: 130.5
Length of text Hello world Length is ${ Length(input) } Length is 11
Extract numbers (only) Hello 123 world 56 and 10 ${ Numbers(input)[0] } 123
Extract words (only) Hello 123 world 56 and 10 ${ Words(input)[2] } and
Extract on/off (only) Hello on on world off bye on ${ OnOffs(input)[2] } off
Extract end of string using start-index Pin is: 1234 to enter ${ Substring(input, 8) } 1234 to enter
Extract part of string by splitting using string comma,separated,words,as,example ${ Split(input, “,”)[2] } words
Extract part of string by splitting using regex Find the second three-digit number: 55 9 222 44 888 123 ${ Regex(input, “\b\d{3}\b”)[1] } 888
Extract part of string using start-index and length Pin is: 1234 to enter ${ Substring(input, 8, 4) } 1234
Round numbers7.279876543${ round (ParseNumber(input),2) }7.28
Replace part of string E-mail is hello@example.com ${ Replace(input, “E-mail”, “Username”) } Username is hello@example.com
Conditional statement 39 Water is ${ If( ParseNumber(input) > 32, “liquid” , “ice”) } Water is liquid *
* pls note than the second argument (“ice” in the example) can NOT be omitted. Put “null” as an argument if you don’t want any action.
Conditional based on device valueHS4 device Id 123 has value 0${ If (val123 = 0 , “off” , “on” ) }off
True/false compare strings equalWinter${(input) = “Summer”}False
True/false compare strings not
equal
Winter ${(input) <> “Summer”} True
True/false statement start !00 NAME = 44 ${ StartsWith(input, “!00”) } True
True/false statement end !00 NAME = 44 ${ EndsWith(input, “45”) } False
True/false statement regex !00 NAME = 44 ${ RegexMatch(input, “^!\d\d \w* = \d*$”) } True
Parsing JSON string
JSON
{ “users”: [{ “name”: ‘Johan’}] } ${ JSON(input, “users[0].name”) } Johan
Parsing JSON number
JSON_Num
{ “temperature”: 22 } ${ 33 + JSON_Num(input, “temperature”) } 55
Parse JSON and apply any of the above expressions on result
JSON_Exp
{ “ID” : “Model RT4572 Serial number# 765431”}${JSON_Exp(Input,”ID”,”Numbers(input)[1]”)}765431
Replace strings using Regex. 1 444 2 555${RegexReplace(Input,“\b\d{3}\b”,0,“\b\d{3}\b”,1)}1 555 2 555
In this example, first Regex finds first 3 digit number and second Regex finds the desired replacement which is second 3 digit number

Click here to see more information about RegEx for advanced users. Click here to learn more about JSON Parsing.