---
title: "Scripted signals"
description: "Compute new signals in RemotiveBroker with Lua scripts, such as battery percentage from capacity, and remap signal names with a scripted signal database."
source: https://developer.remotivelabs.com/docs/remotive-broker/scripted_signals
last_updated: 2026-10-19
deprecated: true
---

# Scripted signals

A scripted interface offers the ability to dynamically compute and generate signals using custom scripts. Scripted signals allows the RemotiveBroker to provide signals using VSS or signals intended for Android. it's also possible to provide custom aggregation or custom events as signals. Unlike signals statically described in a signal database, a scripted signal is generated on-the-fly according to the logic defined in a script. For more information see [how to configure a scripted interface](https://developer.remotivelabs.com/docs/remotive-broker/configuration/scripted.md).

## Example use case
Imagine you need to monitor the percentage of battery remaining in your vehicle. However, your signal database only includes signals for remaining battery capacity and total battery capacity. By leveraging a scripted interface, you can write a simple Lua script to define a new signal that calculates and returns the battery percentage.

With a simple Lua script, it's possible to define a scripted signal that returns the battery percentage.
You can find an example of such a script in the samples repository: [`Vehicle.Powertrain.TractionBattery.StateOfCharge.Displayed.lua`](https://github.com/remotivelabs/remotivelabs-samples/blob/main/python/subscribe-to-scripted-signal/configuration/scripts/Vehicle.Powertrain.TractionBattery.StateOfCharge.Displayed.lua).

## Scripted signals database
A scripted signal database provides the ability to configure simple signal name remapping and specify the location of custom signal transformation scripts.

## Defining a scripted signal

To get an idea of how to define scripted signals, investigate [example code](https://github.com/remotivelabs/remotivelabs-samples/blob/main/python/subscribe-to-scripted-signal) in the samples repository 
together with [RemotiveCloud](https://cloud.remotivelabs.com) (free sign-up required) or with your own RemotiveBroker.

If using cloud, sign-up and use recording "City drive to Turning Torso".

There are three things that need to be put in place:
- an interface with a type "scripted" in the [broker configuration file](https://github.com/remotivelabs/remotivelabs-samples/blob/5e4889b0718180c6bc836f0fe1e601287b1d3bc8/python/subscribe-to-scripted-signal/configuration/interfaces.json#L23-L28)
- a scripted [signals database file](https://github.com/remotivelabs/remotivelabs-samples/blob/main/python/subscribe-to-scripted-signal/configuration/vss_signals.json) (defined in json) that's [referenced](https://github.com/remotivelabs/remotivelabs-samples/blob/main/python/subscribe-to-scripted-signal/configuration/interfaces.json#L26) by the scripted interface
- a [directory with Lua scripts](https://github.com/remotivelabs/remotivelabs-samples/tree/main/python/subscribe-to-scripted-signal/configuration/scripts) that define the computations and is [referenced](https://github.com/remotivelabs/remotivelabs-samples/blob/main/python/subscribe-to-scripted-signal/configuration/vss_signals.json#L4) in the scripted signals database file

## Simple mappings
The scripted signals database allows you to rename signals from different namespaces, making them more intuitive.
For example, if you want to subscribe to a signal named `Vehicle.Speed` but your signal database names it `ID257DIspeed.DI_vehicleSpeed`, you can use a `scripted` interface to remap it with the following database:

```json
{
    "simple_mapping": {
        "Vehicle.Speed": {
            "namespace": "VehicleBus",
            "name": "ID257DIspeed.DI_vehicleSpeed"
        }
    }
}
```
Take a look at [this example](https://github.com/remotivelabs/remotivelabs-samples/blob/main/python/subscribe-to-scripted-signal/configuration/vss_signals.json) or the [configuration example](https://developer.remotivelabs.com/docs/remotive-broker/configuration/scripted.md) for more inspiration.

## Changing frequency of signals
A specific kind of computation you can perform with scripted signals is to change the frequency of emitted signals.

If you wish to change the frequency to 10 updates per second, then take a look at
[an example script](https://github.com/remotivelabs/remotivelabs-samples/blob/main/python/subscribe-to-scripted-signal/configuration/scripts/Vehicle.Powertrain.TractionBattery.StateOfCharge.Displayed_10Hz.lua)
for inspiration on how to achieve that.

## Video guide on how to iterate to create a custom signal with a Lua script

[Embedded video](https://www.youtube.com/embed/9sgWYI50pOs?si=tl6dViQ4MomBj5e1&start=562)
