From 600257d19a3b4878345e2eb67e8232b1dec3278a Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Fri, 7 Apr 2023 09:34:38 +0200 Subject: [PATCH] Cleanup unused code --- src/apps/plant.py | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/src/apps/plant.py b/src/apps/plant.py index 9b376bd..2c4324d 100644 --- a/src/apps/plant.py +++ b/src/apps/plant.py @@ -100,30 +100,6 @@ class HAPlant: def get_detailed_state(self, attribute): return self.details.get(attribute, {}).get("state", None) - def get_detailed_attribute(self, attribute, attribute_name): - return ( - self.details.get(attribute, {}) - .get("attributes", {}) - .get(attribute_name, "") - .replace("ยต", "u") - ) - - def get_plant_status(self, attribute): - status = self.get_plant_attribute(f"{attribute}_status") - if status is None: - return "N/A" - status = status.upper() - if status == "OK": - return "OK" - detailed_state = self.get_detailed_state( - attribute - ) + self.get_detailed_attribute(attribute, "unit_of_measurement") - if status == "LOW": - return f"Bas ({detailed_state})" - if status == "HIGH": - return f"Haut ({detailed_state})" - return status - def fetch_states(self) -> None: self.plant_state = fetch_state(secrets.HA_PLANT_ID) self.details["moisture"] = fetch_state(secrets.HA_PLANT_MOISTURE_SENSOR)