1786890987

This commit is contained in:
2026-08-16 16:36:27 +02:00
parent a9b4e75539
commit f51d4b33cb
5 changed files with 96 additions and 8 deletions

View File

@@ -17,6 +17,7 @@ paste = "1.0.15"
ureq = { version = "3.4.0", default-features = false, features = ["json", "rustls"] }
serde = { version = "1.0.229", features = ["derive"] }
plotters = "0.3.7"
battery = "0.7.8"
[features]
dev = ["slint/backend-winit-x11"]

View File

@@ -17,4 +17,7 @@ pub enum AppError {
#[error(transparent)]
HomeAssistant(#[from] Box<hass_rs::HassError>),
#[error(transparent)]
Battery(#[from] battery::Error),
}

View File

@@ -19,6 +19,18 @@ use crate::{
async fn main() -> Result<(), AppError> {
dotenvy::dotenv().ok();
let manager = battery::Manager::new()?;
for (idx, maybe_battery) in manager.batteries()?.enumerate() {
let battery = maybe_battery?;
println!("Battery #{}:", idx);
println!("Vendor: {:?}", battery.vendor());
println!("Model: {:?}", battery.model());
println!("State: {:?}", battery.state());
println!("Time to full charge: {:?}", battery.time_to_full());
println!();
}
#[cfg(not(feature = "dev"))]
slint::platform::set_platform(Box::new(trekstor::Trekstor::new())).expect("set platform");