Conversion Functions

Conversion functions and pulse meters for variables and analog inputs

This guide focuses on conversion functions and impulse‑measuring devices. We will illustrate 3 scenarios where they are used.

The most common use of conversions is assigning a measurement unit to dimensionless variables.

Available conversion units

TapHome supports the following measurement units for conversion:

  • Atmospheric pressure [mbar]
  • CO [ppm]
  • CO₂ [ppm]
  • Voltage [V]
  • Current [A]
  • Energy [kWh]
  • Frequency [Hz]
  • Noise [dB]
  • Light intensity [lux]
  • Brightness [%]
  • Electricity price per kWh [€/kWh]
  • Gas price per kWh [€/kWh]
  • Water price per m³ [€/m³]
  • Energy content in gas [kWh]
  • Operating hours [s]
  • NOx [ppm]
  • Precipitation [mm]
  • Gas power consumption [kW]
  • Gas consumption [m³/h]
  • Rotational speed [RPM]
  • Monetary value [€]
  • Percentage [%]
  • pH
  • Motion
  • Water flow [m³/h]
  • Airflow [m³/h]
  • Wind speed [km/h]
  • Snow [mm]
  • Gas consumption [m³]
  • Water consumption [m³]
  • State of charge [%]
  • Status contact
  • Temperature [°C]
  • Session duration [s]
  • Angle [°]
  • Humidity [%]
  • VOC [ppm]
  • Water pressure [bar]
  • Power [kW]
  • Water level [m]
  • Battery health [%]

Where conversions are used

Conversions can be applied to:

  • Variables (SettingsVariablesAdd variableGeneral variable )
  • Analog output values

Linear interpolation

Currently, the only supported conversion is linear interpolation.

Example for converting a variable to current (A):

  • 0 → 0 A
  • 1 → 1 A

The system automatically interpolates values between these two points.

Measurement unit for variables

We will create a variable that calculates the average temperature from three thermometers using a formula. We will then assign it the measurement unit “Temperature” in degrees Celsius.

Procedure

  1. Create a new variable

    • Go to SettingsVariables
    • Click Add variableGeneral variable
    • Choose the zone and category
  2. Add a Smart Rule “Formula”

    • Add the Smart Rule Formula to the variable
    • Use all 3 thermometers as input variables
    • Select the variable as the output device
    • Formula to calculate the average: (sensor1 + sensor2 + sensor3) / 3
    • After saving, the variable will receive a new calculated value
  3. Define the conversion

    • The variable currently displays the value only as a number
    • Open the variable’s service settings
    • Define the conversion: select Temperature [°C]
    • Save

Now, instead of a bare number, the variable displays both the value and the physical quantity we wanted to obtain.

Calculating electricity costs

You can calculate electricity costs in Euros based on consumption data from electric meters or meter groups. This is useful for monitoring expenses in real-time.

Procedure

  1. Create a variable for the electricity price

    • Go to SettingsVariables
    • Click Add variableGeneral variable
    • Name it (e.g., “Electricity Price per kWh”)
    • Set the initial value to your current electricity rate (e.g., 0.25 for 0.25 €/kWh)
    • In service settings, set the conversion to Electricity price per kWh [€/kWh]
  2. Create a variable for the calculated cost

    • Go to SettingsVariables
    • Click Add variableGeneral variable
    • Name it (e.g., “Total Electricity Cost”)
    • Choose the zone and category
  3. Add a Smart Rule “Formula” to calculate the cost

    • Add the Smart Rule Formula to the cost variable
    • Use the consumption value from your electric meter (or meter group) as input variable
    • Use the price variable as the second input
    • Select the cost variable as the output device
    • Formula: consumption * price
    • Save
  4. Define the conversion for the cost variable

    • Open the cost variable’s service settings
    • Set the conversion to Monetary value [€]
    • Save

Now the cost variable will automatically display the electricity consumption value in Euros.

To track costs for a group of electric meters, use the group’s total consumption value as the input for the formula.

Measurement unit for analog inputs

Conversion functions are also used when working with analog sensors.

As an example, we will show how to configure a pressure sensor in a retention tank which, depending on the water pressure, outputs a voltage from 0 to 10 V.

Configuration steps

  1. Configure the analog input

    • Go to SettingsHardware → TapHome Bus
    • Select the module (e.g., UI32)
    • Select the input to which the analog sensor is connected
    • Set its function to Analog input
    • Choose the zone and category
    • Save
  2. Set the conversion

    • Go to the input’s service settings
    • Add a conversion to the device
    • For the pressure sensor to measure the water level, select Water level [m]
  3. Define linear interpolation

    Set it according to your sensor’s specifications:

    Input voltage Pressure Water level
    0 V 0 Pa 0 m
    10 V 40 kPa 4 m
    • Save

The system can now automatically convert the value it reads from volts to the unit of your choice.

Impulse‑measuring devices

We will also look at working with an impulse counter and impulse‑based meters. In our example, we will use a rain gauge connected to an impulse counter.

Configuration steps

  1. Configure the impulse counter

    • Go to SettingsHardware → TapHome Bus
    • Select the module (e.g., UI32)
    • Select the input to which the impulse counter is connected
    • Set its function to Impulse Counter
    • Choose its zone and category
    • Save
  2. Add a rain gauge

    • Go to SettingsVirtual Devices
    • Add Rain gauge
    • Assign a zone and category to the device
    • Save
  3. Link the rain gauge to the impulse counter

    • Open the rain gauge’s service settings
    • Link it to the impulse counter
    • Adjust other service settings to match your device’s specifications (e.g., how many mm of rainfall one impulse represents)
    • Save

You can now see how the millimeters of measured rainfall increase with the number of impulses.

The same principle applies to pulse‑type electricity meters and other impulse‑measuring devices such as water meters or gas meters.