Compare commits

..

1 Commits

Author SHA1 Message Date
267578ef0b
streamline tank state mqtt information structure 2025-03-15 15:16:20 +01:00

View File

@ -113,6 +113,14 @@ impl TankState {
}
}
pub fn got_error(&self, config: &TankConfig) -> Option<TankError> {
match self {
TankState::TankSensorPresent(raw_value_mv) => raw_voltage_to_tank_fill_percent(*raw_value_mv, config).err(),
TankState::TankSensorError(err) => Some(err.clone()),
TankState::TankSensorDisabled => Some(TankError::SensorDisabled),
}
}
pub fn as_mqtt_info(&self, config: &TankConfig, water_temp: Result<f32, anyhow::Error>) -> TankInfo {
let mut tank_err: Option<TankError> = None;
let left_ml = match self.left_ml(config) {