From 9d53bee6b21c54d6600f63c3d46364f7f26941ca Mon Sep 17 00:00:00 2001 From: Martijn Date: Wed, 28 Aug 2024 14:30:41 +0200 Subject: [PATCH] #68 Add method to fetch water level from claire state --- py_driver/driver.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/py_driver/driver.py b/py_driver/driver.py index f983b2d..1610025 100644 --- a/py_driver/driver.py +++ b/py_driver/driver.py @@ -124,6 +124,14 @@ def tube1_level(self) -> Optional[float]: def tube2_level(self) -> Optional[float]: return self.convert_distance_to_level(self.Tube2_sonar_dist_mm) + def get_tube_level(self, tube): + if tube == 1: + return self.tube1_level + if tube == 2: + return self.tube2_level + else: + raise RuntimeError(f"Unexpected tube number {tube}.") + class ClaireDevice: """