Project web site: mekops.com/projects/siphon
This is a program used to gather data from various sources (like MQTT topics) and push the data to different sinks (e.g. to file, Gotify notification service, IOTPlotter). Dynamically configurable and intended to be deployed as a containerized service.
Siphon uses a decoupled architecture where data collection, routing, and delivery are separated by an internal event bus.
graph LR
subgraph Sources [Collectors]
A1[MQTT]
A2[File]
A3[Shell]
A4[Home Assistant]
A1 ~~~ A2 ~~~ A3 ~~~ A4
end
B((Internal Bus))
subgraph Processing [Pipelines]
C1[Extract: Parsers]
C2[Transform: expr]
C3[State Management]
C1 --> C2 --> C3
end
subgraph Destinations [Sinks]
D1[REST / ntfy / Gotify]
D2[MQTT]
D3[File / CSV]
D4[Internal Bus]
D1 ~~~ D2 ~~~ D3 ~~~ D4
end
Sources -- publishes --> B
B -- triggers --> Processing
Processing -- dispatches --> Destinations
- Collectors: Ingest data from external sources and publish raw payloads to the internal event bus.
- Internal Bus: A thread-safe pub/sub system that decouples data ingestion from processing.
- Pipelines (v2): The core processing logic.
- Extract: Uses Parsers (JSONPath, Regex) to pull specific values from payloads.
- Transform: Uses the expr engine to calculate new values or modify existing data.
- State: Supports Stateful processing to accumulate data over time (e.g., running averages or sums).
- Triggers: Can be Event-driven (immediate) or Cron-based (scheduled).
- Sinks: Deliver processed data to external services or back into the internal bus.
Configuration is in YAML file. Example is in configs
Siphon features an integrated, web-based configuration editor powered by ace.js. This allows you to modify your pipelines, collectors, and sinks directly through a browser with syntax highlighting and validation.
Siphon is designed to work seamlessly with Home Assistant.
- Collector: Includes a dedicated
hasscollector to poll entity states. - Add-on: Siphon is available as a pre-packaged Home Assistant Add-on. See the siphon-ha-addon repository for installation instructions.
Using the %%ENV_VARIABLE%% notation it's possible to substitute this entries with environment variables, which may be
useful to use same config in different environments, but with some things that are different (e.g. HOSTNAME, some kind
of secrets).
Used in:
data.<name>.conv- to convert variable, e.g. multiply the value by 10 (val * 10)dispatchers.sink[].spec- whentypeisexprit can be used for templating, e.g. to generate json (toJSON(val))
Syntax for the evaluation is documented here: Expr Language Definition
This project uses ko as a build system. See the current defaults in the config file.
By default containers for 32/64 bit arm and 64 x86 architectures are being built. Example deployment using
docker-compose.yml may be like in this example:
version: '2'
volumes:
config:
services:
siphon:
image: ghcr.io/mekops-labs/siphon:latest
command:
- /config/config.yaml
volumes:
- config:/config
restart: alwaysConfiguration file (config.yaml) needs to be manually copied to the config volume in this case. command is giving
an argument to the siphon application, where to look for it.
Adding additional collectors, parsers, and sinks is pretty much self-contained. Only necessary things is to add the
module code itself and import it in internal/modules/modules.go. Take a look at the other modules as an example, like
file collector.
