Toggle Navigation
Hatchery
Eggs
SensorThingy
manager.py
Users
Badges
Login
Register
MCH2022 badge?
go to mch2022.badge.team
manager.py
raw
Content
import ujson class SensorManager: "SensorManager supervises different Sensors and produces logs." LOGFILE = "sensors.json" def __init__(self, sensors, logfile=LOGFILE): self._sensors = sensors self._logfile = logfile def dump_log(self): f = open(self._logfile, "a") for sensor in self._sensors: ujson.dump(sensor.to_dict(), f) f.write("\n") f.close()