GrowSystem/grow_system.py

25 lines
637 B
Python

import time
from moisture_sensor import MoistureSensor
class GrowSystem:
moisture_sensor = None
most_recent_values = {}
def __init__(self, settings):
print("hello from GrowSystem")
print(settings)
if not self.moisture_sensor:
self.moisture_sensor = MoistureSensor(settings['moisture_sensor'])
def start(self):
print("Start reading sensors ...")
while True:
self.moisture_sensor.read()
self.most_recent_values['moisture_sensor'] = self.moisture_sensor.most_recent_value
print(self.most_recent_values)
time.sleep(1)