Universal Data Source
What is universal-data-source?
universal-data-source
is a program for reading various measurements from many sources. It's designed to send data as JSON directly to home-panel in a universal format. Feel free to use it as a source for your own projects.
Supported sources
- 1-Wire temperature sensors
- Network UPS Tools
Supported destinations
Active data sender
Any HTTP(S) server that accepts JSON data in the following format:
If a module is disabled, it simply returns an empty array for the corresponding key.
Passive endpoint
You may send HTTP requests with or without authentication (depending on your configuration) to the following paths:
GET /temperature
GET /temperature/<id>
GET /ups
GET /ups/<id>
How to use it?
- Run
./universal-data-source
to generate a default configuration file. You can also specify a path to a custom configuration file usingUDS_RS_CONFIG_FILE
environment variable (ex.UDS_RS_CONFIG_FILE=/etc/universal-data-source/config.toml universal-data-source
). - Edit the configuration file to your needs. Most of the settings are optional and have default values. See Configuration section for more details.
- Run
./universal-data-source
again to start the program. Remember to keep theUDS_RS_CONFIG_FILE
environment variable set if you're using a custom configuration file.
Configuration
Environment variables
All top-level options
The configuration file is written as a JSON object. See table below for a list of all available options. Missing modules are disabled by default.
Types explained
OneWireConfig
Duration
UpsMonitoringConfig
NetworkUpsToolsClientConfig
UninterruptiblePowerSupplyConfig
ActiveSenderConfig
Endpoint
How to run it as a systemd service?
How to build?
Native compilation
- Install Rust and Cargo (but you probably already have them installed). See https://rustup.rs for more details.
- Install OpenSSL development libraries. On Debian-based systems, run
sudo apt install libssl-dev
. - Clone this repository.
- Run
cargo build --release
inside the repository. - The binary will be located at
target/release/universal-data-source
.
Cross-compiling
If you want to cross-compile the binary, you can use the cross
tool. It requires Docker to be installed.
- Install
cross
usingcargo install cross
. - Run
cross build --release --target <target>
inside the repository.
How to run tests?
Run cargo test
inside the repository.
How to contribute?
If you want to contribute, please fork this repository, create a new branch and submit a pull request. It will be reviewed and merged if it's a good fit. You may also create an issue if you find a bug or have a feature request.
License
This project is licensed under the Open Software License version 3.0 - see the LICENSE file for details.