diff --git a/Cargo.lock b/Cargo.lock index d8de257..343ea2a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -239,7 +239,7 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "charge-controller-supervisor" -version = "1.9.9-pre-13" +version = "1.9.9-pre-14" dependencies = [ "chrono", "clap", @@ -2203,7 +2203,7 @@ dependencies = [ [[package]] name = "tesla-charge-controller" -version = "1.9.9-pre-13" +version = "1.9.9-pre-14" dependencies = [ "chrono", "clap", diff --git a/Cargo.toml b/Cargo.toml index 463e68a..c7dbd61 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ default-members = ["charge-controller-supervisor"] resolver = "2" [workspace.package] -version = "1.9.9-pre-13" +version = "1.9.9-pre-14" [workspace.lints.clippy] pedantic = "warn" diff --git a/charge-controller-supervisor/src/tristar.rs b/charge-controller-supervisor/src/tristar.rs index 0aa2140..48c4f46 100644 --- a/charge-controller-supervisor/src/tristar.rs +++ b/charge-controller-supervisor/src/tristar.rs @@ -256,8 +256,10 @@ impl ChargeStateGauges { impl Tristar { pub fn new(serial_port: &str, friendly_name: &str, baud_rate: u32) -> eyre::Result { - let modbus_serial = - tokio_serial::SerialStream::open(&tokio_serial::new(serial_port, baud_rate))?; + let modbus_serial = tokio_serial::SerialStream::open( + &tokio_serial::new(serial_port, baud_rate).timeout(std::time::Duration::from_secs(3)), + )?; + let slave = tokio_modbus::Slave(DEVICE_ID); let modbus = tokio_modbus::client::rtu::attach_slave(modbus_serial, slave); let charge_state_gauges = ChargeStateGauges::new(friendly_name);