1786890987
This commit is contained in:
@@ -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"]
|
||||
|
||||
@@ -17,4 +17,7 @@ pub enum AppError {
|
||||
|
||||
#[error(transparent)]
|
||||
HomeAssistant(#[from] Box<hass_rs::HassError>),
|
||||
|
||||
#[error(transparent)]
|
||||
Battery(#[from] battery::Error),
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user