diff --git a/src/main.rs b/src/main.rs index a51b940..492e7a7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -43,8 +43,9 @@ fn main () { match action { "on" => pin_switch_on(), "off" => pin_switch_off(), + "status" => println!("Inverter status: {}" , if pin_status() == 0 { "off" } else { "on" }), "test" => pin_test(&config), - &_ => println!("So far only the parameters 'on', 'off' and 'test' are supported.") + _ => println!("So far only the parameters 'on', 'off', status and 'test' are supported.") } } else { // no command line parameter set; check for voltages and switch the inverter accordingly @@ -101,7 +102,7 @@ fn get_current_voltage (config: &Config) -> f32 { } let db_connection = sqlite::open(&config.database).unwrap(); - let query = format!("SELECT data FROM '{device}' ORDER BY date DESC, time DESC LIMIT 1;", device = &config.device_name_voltage); + let query = format!("SELECT data FROM '{device}' ORDER BY date DESC, time DESC LIMIT 1;", device = config.device_name_voltage); let _ = db_connection.iterate(query, |pairs | { let data = pairs.get(0).unwrap().1.unwrap();