How does Unit Configuration module work?


ImperiHome comes with a Unit Configuration module available in the configuration contextual menu of sensors (temperature, wind, hydrometry, electricity ...).
This module allows you to set two optional properties that can be configured independently one from the other:

  • A formula that will be applied on the value received from the system.
  • The unit that will be displayed right after the value. 


While the unit is only plain text that will be displayed as is, the formula is an expression that will be evaluated by the system and thus has to respect a syntax.


This feature relies on exp4j which allows following operators and supports parenthesis:

  • Addition: +
  • Subtraction: -
  • Multiplication: *
  • Division: /
  • Exponentiation: ^
  • Modulo: %
  • absolute value: abs
  • arc cosine: acos
  • arc sine: asin
  • arc tangent: atan
  • cubic root: cbrt
  • nearest upper integer: ceil
  • cosine: cos
  • hyperbolic cosine: cosh
  • euler's number raised to the power (e^x): exp
  • nearest lower integer: floor
  • logarithmus naturalis (base e): log
  • sine: sin
  • hyperbolic sine: sinh
  • square root: sqrt
  • tangent: tan
  • hyperbolic tangent: tanh

To use the raw value retrieved from the system inside the formula, the keyword val must be used.

- Celsius to Fahrenheit formula: ((val * 9) / 5) + 32

Once a formula defined, it will be used each time the value from this sensor needs to be displayed (list view, dashboard view, graph ...)

If the formula is erroneous, it won't be recorded and a toast message will be displayed to inform you.

If the retrieved value from the system is not a double (a string for instance for custom sensor), and if a formula has been defined, ImperiHome will first try to convert the value to a double. If it fails, then the raw value will be used.

You can always erase a formula and retrieved default unit by pressing the "Reset" button in the dialog box.

Have more questions? Submit a request


  • 0
    Peter Stothers

    Hi. I have a sensor that is configured on my Vera 2 to detect when the garage door is up or down but it has to be added in MIOS as a lux sensor (long story) so when the door is down, Vera reports it as 0 lux. Can I use the Unit Configuration module to report <50% lux as 'Down' and >50% lux as 'UP'?

  • 0

    Hello. Is it possible to use system variables like hours, minutes ... in the formula ?

    Thank you.

  • 0
    Rich Lumb

    I have the App on my phone and on an.asus tablet which is used locally for all setting. My problem is that on the virtual thermostat the resolution is only 1deg C on the tablet but 0.5deg C on my phone.-- why do I not have 0.5 which is preferred on both and how can I change this

Please sign in to leave a comment.
Powered by Zendesk