Exemple #1
0
def loadPlantAndOrderList(args):
	plantName = args[0]
	orderListName = args[1]
	configName = args[2]

	plant = Plant.fromXmlFile(plantFileExists(plantName))
	orderList = OrderList.fromXmlFile(orderListExists(orderListName), plant)
	configFile = configFileExists(configName)

	return plant, orderList, configFile
Exemple #2
0
    def main(self):
        """
        starting point of the code
        """
        print("Starting Pot-O-Duino ...")

        # Sign in 2 Firebase
        # self.firebaseCOM = FirebasePlantCom(piID = "123")

        # Make Plant and its SensorController
        # sensorController1 = SensorController(moisture=0, light=1, ph=-1, humidity = 0, temperature = 0)

        plant0 = Plant(name=self.firebaseCOM.plantName,
                       type_="Aloe",
                       sensorController="")

        # imgPiIDPath = "Users/-M4fSQFTJYiPq3lxwT0o/ImageImageImage"
        # data = self.firebaseCOM.db.child(imgPiIDPath).get()
        # print(data.val()[0:10])

        # plantType = run_img_guessing(data.val())

        level = 0
        # Gather data and send 2 Firebase
        print("Gathering data from sensors and sending to Firebase ...")
        try:
            while True:
                time.sleep(0.01)
                # plant0.set_all_data()
                # plantData = plant0.get_all_data()
                level = level + 2
                plantData = {
                    "light": level,
                    "moisture": 1,
                    "temperature": 1,
                    "humidity": 1
                }
                piID = 1
                piIDPath = self.firebaseCOM.get_firebasePlantPath()
                # print(piIDPath)
                self.firebaseCOM.update_pi_data(piIDPath, plantData)
                # plant0.print_plant()

        except KeyboardInterrupt:
            print('interrupted!')
Exemple #3
0
    def main(self):
        """
        starting point of the code
        """
        print("Starting Pot-O-Duino ...")

        # Sign in 2 Firebase
        self.firebaseCOM = FirebasePlantCom(piID="1")

        # Make Plant and its SensorController
        sensorController1 = SensorController(moisture=0,
                                             light=1,
                                             ph=-1,
                                             humidity=0,
                                             temperature=0)

        plant0 = Plant(name=self.firebaseCOM.plantName,
                       type_="Aloe",
                       sensorController=sensorController1)

        # Gather data and send 2 Firebase
        print("Gathering data from sensors and sending to Firebase ...")
        try:
            while True:
                time.sleep(0.01)
                plant0.set_all_data()
                plantData = plant0.get_all_data()

                piIDPath = self.firebaseCOM.get_firebasePlantPath(
                )  # getting the path to the appropriate branch to update on firebase
                self.firebaseCOM.update_pi_data(piIDPath, plantData)
                plant0.print_plant()
                if plant0.dry():
                    plant0.sensorController.watering()

        except KeyboardInterrupt:
            print('interrupted!')
Exemple #4
0
def loadNewPlantAndOrderList(testNum):
    plantFilename, orderListFilename = benchmarkFileExists(testNum)
    plant = Plant.fromXmlFile(plantFilename)
    orderList = OrderList.fromXmlFile(orderListFilename, plant)
    return plant, orderList
Exemple #5
0
def schedulerPerf(args):
	testNum = args[0]
	plantFilename, orderListFilename = benchmarkFileExists(testNum)
	plant = Plant.fromXmlFile(plantFilename)
	orderList = OrderList.fromXmlFile(orderListFilename, plant)
	Controller(plant, orderList).schedulerPerf(testNum)