class App: def __init__(self): print("[APP ] Initialized\n") self.d = Display() self.ds = DataStore() self.sett = AppSettings() self.keypad = Keypad() self.sensors = Sensors() self.lightc = LightController(self.ds, self.sett) self.condc = CondController(self.ds, self.sett) self.fanc = FanController(self.ds, self.sett) self.evc = EVController(self.ds, self.sett) self.screenMngr = ScreenManager(self.d, self.ds, self.sett, self.keypad) self.screenMngr.update() self.processStart = 0 self.screensStart = 0 def process(self): delta = time.time() - self.processStart if (delta > 1.0): self.ds.add_humidity(self.sensors.humidity()) self.ds.add_temperature(self.sensors.temperature()) self.ds.add_lux(self.sensors.lux()) if (self.lightc != None): self.lightc.process() if (self.condc != None): self.condc.process() if (self.fanc != None): self.fanc.process() if (self.evc != None): self.evc.process() self.processStart = time.time() def handleScreens(self): delta = time.time() - self.screensStart if (delta > 1.0): self.screenMngr.update() self.screensStart = time.time() self.screenMngr.process()
import os, sys currentdir = os.path.dirname(os.path.realpath(__file__)) parentdir = os.path.dirname(currentdir) sys.path.append(parentdir + "/classes") from datastore import DataStore from sensors import Sensors s = Sensors() ds = DataStore() ds.add_humidity(s.humidity()) print(ds.get_humidity())