cleanup main and network state handling

This commit is contained in:
2025-05-27 23:47:14 +02:00
parent 4f4d15e4a4
commit 3fe9aaeb6f
4 changed files with 204 additions and 145 deletions

View File

@@ -119,7 +119,7 @@ impl TankState {
pub fn as_mqtt_info(
&self,
config: &TankConfig,
water_temp: Result<f32, anyhow::Error>,
water_temp: &anyhow::Result<f32>,
) -> TankInfo {
let mut tank_err: Option<TankError> = None;
let left_ml = match self.left_ml(config) {
@@ -151,7 +151,7 @@ impl TankState {
.as_ref()
.is_ok_and(|temp| *temp < WATER_FROZEN_THRESH),
water_temp: water_temp.as_ref().copied().ok(),
temp_sensor_error: water_temp.err().map(|err| err.to_string()),
temp_sensor_error: water_temp.as_ref().err().map(|err| err.to_string()),
percent,
}
}