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.

Built-in Services

The following services are available by device type:

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

In addition to these built-in services, it is also possible to create fully custom services that run alongside the defaults on device boot. 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:

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.

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.

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.