import threading from time import sleep from kuukar_lcd import lcd from kuukar_leds import leds from kuukar_sensors import sensors class environment: t_alerted = False h_alerted = False def __init__(self, lcd: lcd, leds: leds, sensors: sensors) -> None: self.lcd = lcd self.leds = leds self.sensors = sensors threading.Thread(target=self.__checker__).start() def __checker__(self): while True: if self.sensors.get_temperature() > 38.0: if not self.t_alerted: lcd.keke_died() self.t_alerted = True else: self.t_alerted = False if self.sensors.get_humidity_pct() > 60.0: if not self.h_alerted: lcd.keke_cute_noise() self.h_alerted = True else: self.h_alerted = False sleep(5)