Skip to content

Rust implementation of the Hyperion Ambient Lighting software

License

Notifications You must be signed in to change notification settings

alixinne/hyperion.rs

Repository files navigation

Build Docs GitHub

hyperion.rs is a rewrite of hyperion.ng in the Rust Programming Language. This version features:

  • Very low resource requirements (can be run on a single thread, useful for the Raspberry Pi Zero for example)
  • No memory leaks (most allocations are static anyways)
  • Easy to compile and cross-compile

Disclaimer: this is an early work-in-progress:

  • A lot of internals may still change, in case you would like to contribute please contact me beforehand.
  • Only a small subset of the original project's features are currently supported. This means that unless you're using it in the exact same context as I am (Android TV Grabber + Raspberry Pi Zero W + WS2815 LED strip), this might not be for you.

Compatibility

Currently implemented features:

  • Loading settings from the hyperion.ng database
  • File, WS2812SPI devices
  • JSON, Protobuf, Flatbuffers and Boblight server
  • Black border detector, color channel adjustments, smoothing
  • Basic effect support (only setColor and setImage, no custom smoothing, no per-instance effect directory). Can be disabled if Python is not available for the target platform (see the python feature).

Extra features not available in hyperion.ng:

  • Hooks (global start, stop, and instance start, stop, activate, deactivate)
  • RGB color temperature adjustment

Configuration

Migrating your settings

This rewrite uses the same database format for storing settings. In order to load your existing hyperion.ng settings, assuming you are in your home directory:

# Create config directory for hyperion.rs
$ mkdir -p .config/hyperion.rs/

# Copy the existing hyperion.ng database to the new location for hyperion.rs
$ cp .hyperion/db/hyperion.db .config/hyperion.rs/

Using a TOML file

You may also configure hyperion.rs using a TOML representation of the configuration. To generate the initial file, you can use the --dump-config option:

$ hyperiond-rs --dump-config >config.toml

Then, you can start the daemon using this config file:

$ hyperiond-rs --config config.toml

The minimal configuration required is as follows:

[instances.0.instance]
friendlyName = 'Test instance'
enabled = true

[instances.0.device]
type = 'dummy'

Running hyperion.rs

Once your settings database has been migrated, you can run hyperion.rs using cargo:

$ cargo run

If running from a release archive, invoke the hyperiond-rs binary directly.

Cross-compiling

Cross-compiling is done using cross. Let's say we are building for the Raspberry Pi Zero, which corresponds to the Rust target arm-unknown-linux-gnueabihf.

$ export TARGET=arm-unknown-linux-gnueabihf
$ export ENABLE_PYO3=1

# (if not done already) Install cross
$ cargo install --force cross

# Build the project
$ cross build --release --target $TARGET

# The resulting binaries will be in target/$TARGET/release

License

This work is licensed under the MIT License.

Author

Vincent Tavernier vince.tavernier@gmail.com. Original project and protocol source files by hyperion-project.