---
title: "Conversion Functions"
description: "Assign measurement units to variables and analog inputs, use linear interpolation, impulse counters and a Formula Smart Rule for electricity costs."
url: "https://taphome.com/en/docs/configuration/conversion-functions/"
language: en
lastmod: 2026-10-08
generator: hugo
ai:
  topics: ["conversion-functions","measurement-units","variables","analog-inputs","impulse-counters","linear-interpolation","electricity-cost-calculation"]
  questions: ["How do I assign a measurement unit to a variable in TapHome?","What measurement units are available for conversion in TapHome?","How do I configure an analog pressure sensor to show water level in meters?","How does linear interpolation work for analog inputs in TapHome?","How do I connect a rain gauge to an impulse counter in TapHome?","How to use a Formula smart rule to calculate average temperature from multiple sensors?","Can I use impulse counters with water meters and gas meters too?","How do I calculate electricity costs in Euros from meter consumption?","How to convert kWh consumption to money value in TapHome?"]
---

# Conversion Functions

Conversion functions and pulse meters for variables and analog inputs

Last updated: 2026-10-08

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** (**Settings** → **Variables** → **Add variable** → **General variable**)
- **Analog inputs**

### 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 **Settings → Variables**
   - Click **Add variable → General 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 **Settings → Variables**
   - Click **Add variable → General 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 **Settings → Variables**
   - Click **Add variable → General 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 cost in Euros.

> [!TIP]
> 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 **Settings → Hardware → 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 **Settings → Hardware → 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 **Settings → Virtual 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.

> [!NOTE]
> The same principle applies to pulse-type electricity meters and other impulse-measuring devices such as water meters or gas meters.

**See also** — [Impulse Electric Meter](https://taphome.com/en/docs/configuration/impulse-electric-meter/), [CT Clamp — Current Measurement via Analog Input](https://taphome.com/en/docs/wiring/ct-clamp-analog-input/).
