Each action component in the Action Editor has a pre Pre Mappings / Post Mappings area on the right side of the screen:
Press the “+” button to add a new line to either the Pre-Mappings or the Post-Mappings. Pre Mappings are executed before the main function of the component is conducted. Accordingly, Post Mappings are executed thereafter. Clicking on the + icon will add a new line:
You can write the name of the variable on the left side and the expression or value to be assigned to the variable on the right side. In this example, we are in the Gravio Light component and assign a color to the light:
cp. prefix which refers to the Component Parameter variable. By clicking on the “Show Variable Names” button you can see how the variables in the component are being referred to.
Note that the sequence of execution is from top to bottom
The expressions on the right-hand side can be written as quadratic operations (
/ ) or functions. You can also describe variables with prefixes such as
cv. as variables.
When you assign the evaluation result of a right-hand expression to the left-hand side, the type of the right-hand value (
DateTime ) is converted to the type of the left-hand side.
If you write an expression that is not an assignment (e.g.,
cv.Payload > 10 ), it will return a value of type Bool.
To return a Bool value, you can perform a comparison operation on a number or string.
You can also write conditional or ternary operators to set values, such as
tv.Data == 0 ? 'up' : 'down'
You may want to find out, what certain variable’s values are, especially if they are coming from sensors. You can do that by enabling the icon “debug” toggle icon in your step:
This will show you the variables and the respective values in the Action Manager Log:
You will see the values of the available variables there, reading upside down (as new logfile content is appended at the top):
This shows you, the variables prefixed with tv (trigger variable) are:
… and so on.
Therefore you can access this data in the Gravio action for example like in this File Write step here:
Need more help with this?
Join our slack community for help