Skip to main content

Services


Services, also referred to as managers, are background processes that run independently on the device, each managed by the Salt minion parent process. If a service fails, the Salt minion automatically restarts it and reports the error.

The default services included with an AutoPi device serve as the primary communication layer between the Core software and the corresponding hardware components. This architecture makes services the ideal place to implement operations that are tightly coupled to specific hardware on the device.

Services Table

Built-in Services

The following services are available by device type:

ServiceDescriptionAvailable OnCore Specs
acc_managerManages the accelerometer hardware and provides access to motion and orientation data.AutoPi TMU CM4, AutoPi CAN-FD Proacc_manager
audio_managerControls audio output on the device, such as playing sounds or alerts.AutoPi TMU CM4, AutoPi CAN-FD Proaudio_manager
cloud_managerHandles buffering of data, and sending data in batches to the cloud server.AutoPi TMU CM4, AutoPi CAN-FD Procloud_manager
modem_managerManages the cellular modem, including connectivity, signal monitoring, and data sessions.AutoPi TMU CM4, AutoPi CAN-FD Promodem_manager
event_reactorListens for internal events fired by other services and triggers configured reactions in response.AutoPi TMU CM4, AutoPi CAN-FD Proevent_reactor
obd_managerCommunicates directly with the STN chip to query vehicle data over the OBD-II interface.AutoPi TMU CM4obd_manager
spm_managerInterfaces with the Smart Power Manager (SPM) to handle power states and wake-up logic.AutoPi TMU CM4, AutoPi CAN-FD Prospm_manager
gnss_managerManages the GNSS/GPS module and provides location and positioning data.AutoPi TMU CM4, AutoPi CAN-FD Prognss_manager
crypto_managerControls and holds the connection to the secure element.AutoPi TMU CM4, AutoPi CAN-FD Procrypto_manager
can0_managerHandles communication to and from the vehicle via the SocketCAN channel_1 interface.AutoPi CAN-FD Procan_manager
can1_managerHandles communication to and from the vehicle via the SocketCAN channel_2 interface.AutoPi CAN-FD Procan_manager
disk_housekeeperPerforms file deletion to avoid the disks running full.AutoPi CAN-FD Prodisk_housekeeper

In addition to these built-in services, it is also possible to create fully custom services that run alongside the defaults on device boot, you can read more here: Create Custom Service. Custom services support PIP package requirements, giving you the flexibility to integrate third-party Python libraries as needed.


Configuring a Service

Clicking on any service in the list opens its detail page, which is organized into four tabs:

Configuring a Service

Workers

Workers define workflows that run continuously on the device. Each worker executes a sequence of steps — referred to as a workflow — at a configurable interval and loop count. Workers are the primary mechanism for reading data from hardware, transforming it, and delivering it to a destination.

See the Create Custom Workers guide for a full walkthrough.

Within a service multiple worker threads can run. Each worker is setup to process one or more workflows sequentially for a limited period of time or indefinitely, you can read more here: Workers.

Available options for a worker instance:

FieldTypeDescriptionDefault Value
nameTextSystem name to identify the given worker.-
delayDecimalInitial delay in seconds before starting the worker. No delay if left empty.-
intervalDecimalPause in seconds between each run. Enter 0 if no pause.1
loopIntegerHow many runs should the worker do? Enter -1 if infinite.-1
suppress_exceptionsBooleanSuppress errors/exceptions so that they do not kill the worker thread?True
kill_upon_successBooleanKill the worker thread after the first successful run? Successful means that no errors/exceptions occurred.False
transactionalBooleanEnsure that consecutive workflows are processed in an uninterrupted sequence and not potentially mixed with others from other workers?False

Reactors

Reactors allow the device to respond to incoming events. Each reactor defines a regex pattern to match against event names, along with one or more actions to execute when a match is found. This makes it straightforward to implement event-driven logic directly on the device.

Reactors can be managed using the reactor.manage command, which provides runtime control over the reactor service.

Supported commands:

reactor.manage reactor list
reactor.manage reactor show <name>

See the Reactors guide for a full walkthrough.

Hooks

Hooks extend the behavior of a worker's workflow by registering custom functions at specific points in the pipeline. When creating a hook, you can select one of the following types:

Hook TypeDescription
HandlerThe entry point of the workflow. Communicates with the device hardware and produces the initial output.
ConverterTransforms the handler output into a more usable format.
TriggerExecutes logic based on the result, regardless of whether earlier steps failed. Useful for alerts and events.
FilterDetermines whether the data is significant enough to continue processing. Returns a falsy value to halt the workflow.
EnricherAugments the data by appending computed or supplementary values.
ReturnerDelivers the final result to a destination, such as a file or a cloud endpoint.

See the Create Custom Workers guide for more detail on how hooks fit into the workflow pipeline. Also we have a guides on how to create a custom returners and triggers to fit into your use case, check them out:

Settings

The Settings tab allows you to adjust the configuration of the service without modifying its code. Settings are passed as a JSON object and are accessible from within the service at runtime, making it easy to tune behavior per environment or deployment.

Settings on Service


Workflows

A worker can process one or more workflows in a sequence. A worflow consists of a number of steps. The primary step of a workflow is called handler and is always required. Then more steps may occur both before and/or after, and are not normally required. At present, there are two built-in workflows. Below is an overview of the steps in the first workflow called simple:

handlertriggerfilterreturner

And secondly the extended workflow:

validatorhandlerconvertertriggerfilterenricherreturner

Each step in a workflow has a defined area of responsibility:

StepDescriptionExample
validatorValidates the request and decide whether or not to proceed to the handler.-
handlerProduces a result typically by interacting with an external device or system.See
converterConverts the result returned from the handler into a more usable format.See
triggerDecides whether to trigger an event based on the result.See
filterFilters out result if insignificant.See
enricherEnriches result with additional information. Could for example be calculations.See
returnerReturns the final result to an external system or service.See