... | ... | @@ -6,6 +6,10 @@ Transform Expressions are used for a number of purposes, including: |
|
|
|
|
|
## Simple Transform Expressions
|
|
|
|
|
|
Transform Expressions are entered on the Sensor editing screen. The screenshot below shows a Transform
|
|
|
Transform Expressions are entered on the Sensor editing screen. The screenshot below shows a Transform Expression that is to adjust the reading from a Light Sensor, correcting for light reducing paint that covers the sensor.
|
|
|
|
|
|
[[images/transform_ex1.png]]
|
|
|
|
|
|
In the `Transform or Calculated Field Function Name` box you can see the transform expression: `val*35.0 - 140.0`. The variable `val` is always available in a Transform Expression and it contains the raw sensor value that was posted. This transform multiplies that raw value by 35.0 and then subtracts 140.0. When creating these expressions, you have all the [[built-in functions|https://docs.python.org/2/library/functions.html]] (e.g. `abs()` for absolute value, ) from the Python programming language plus the functions available in the [[Python `math` module|https://docs.python.org/2/library/math.html]] (e.g. `sqrt()`, `sin()`, `log10()`). So, an expression such as `sqrt(val)/(val - 8.6)` is a valid transform expression.
|
|
|
|
|
|
In the above screenshot, note that the `Calculated Field` box is **not** checked. This is not a new calculated field, created from other sensor values or the gathered from the Internet. Instead, this is just a conversion of an incoming sensor value. |
|
|
\ No newline at end of file |