repository to manage all files related to the makeathon farm bot project (Software + Documentation).
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

createdatabase.py 726B

123456789101112131415161718192021
  1. import random
  2. from plantdatabase import PlantDataBase
  3. mydatabase = PlantDataBase('backend_database.db')
  4. mydatabase.create_tables()
  5. for i in range(1, 6):
  6. mydatabase.insert_plant(plantname=f"Pflanze{i}")
  7. for i in range(1, 7):
  8. plant_id = i
  9. temp = random.random()
  10. humidity = random.random()
  11. soil_moisture = random.random()
  12. light_intensity = random.random()
  13. mydatabase.insert_measurement_data(plant_id=plant_id,
  14. sensordata_temp=temp,
  15. sensordata_humidity=humidity,
  16. sensordata_soil_moisture=soil_moisture,
  17. sensordata_brightness=light_intensity)