Skip to content

Read data from Victron devices over Bluetooth Low Energy

License

Notifications You must be signed in to change notification settings

felixwatts/victron_ble

Repository files navigation

Victron BLE

Read data from Victron devices over Bluetooth Low Energy.

Some Victron devices broadcast some aspects of their state over Bluetooth on a regular basis. This crate makes it easy to access that data.

Currently only Solar Charger type devices are supported but support can be added for other device types if requested.

Basic Usage

Use the open_stream function to get a stream of state updates for a given Victron device:

let device_name = "Victon Bluetooth device name";
let device_encryption_key = hex::decode("Victron device encryption key").unwrap();

let mut device_state_stream = victron_ble::open_stream(
    device_name, 
    device_encryption_key
).unwrap();

while let Some(result) = device_state_stream.next().await {
    println!("{result:?}");
}

Encryption Key

The device status messages published by the Victron device are encrypted. In order to decrypt them the device encyption key is needed. This can be found for a given device using the Victron Connect app on iOS or Android.

Using the app, connect to the device, then go to Settings -> Product Info -> Encryption data.

Serialization

If you add the serde feature then the DeviceState enum will be (de)serializable.

Example

An example application is provided which prints the state of a given device to to the terminal.

cargo run --example example <Victron device name> <Victron device encryption key>

Ackowledgements

Various aspects of this crate are either inspired by or copied from these projects:

About

Read data from Victron devices over Bluetooth Low Energy

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages