Skip to content

Function compositions

Function compositions are a special case of openOBD functions that define a recipe of functions that need to be called one after another.

An openOBD Composition is a Python class that inherits the functionality of the OpenOBDComposition class. The construction is exactly the same as for an openOBD Function. It also has the fields id, signature, name etc.

The difference between a composition and a regular function is that a composition defines a sequence of other openOBD functions to execute.

We can setup a composition class as follows:

from openobd import *

from myfunctions.eobd_read_vin import EOBDReadVIN

class MyComposition1(OpenOBDComposition):

    id = ""
    signature = ""
    version = "v0.1"
    name = "Gerhards Composition"
    description = "Gerhards Composition"

    def run(self):
        self.run_function(EOBDReadVIN)
        self.run_function(EOBDReadVIN)

This composition will run the EOBD reader twice.

Run the composition from the dashboard

  • Create the composition script in the myfunctions folder.
  • Register a fixed id and signature and fill out these values in your composition script.
  • Pick a unique name so you recognize your composition in the dashboard.
  • Execute the composition