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.

defines.py 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. """
  2. created by caliskan at 19.04.2023
  3. contains all constants for the backend architecture of the smart garden project
  4. """
  5. MQTT_BROKER_LOCAL = "192.168.0.199"
  6. MQTT_BROKER_GLOBAL = "mqtt.eclipseprojects.io"
  7. RASPI_CLIENT_ID = "smart_farming_raspi"
  8. BACKEND_CLIENT_ID = "smart_farming_server"
  9. MAX_PLANT_COUNT = 6
  10. DATABASE_NAME = 'backend_database.db'
  11. # Topics:
  12. Topics = {
  13. "ROBOT_ACTION_DRIVE": "ROBOT/ACTION/DRIVE",
  14. "ROBOT_ACTION_GETPOSITION": "ROBOT/ACTION/GETPOSITION",
  15. "ROBOT_ACTION_GETBATTERY": "ROBOT/ACTION/GETBATTERY",
  16. "ROBOT_DATA_SENSORDATA": "ROBOT/DATA/SENSORDATA",
  17. "ROBOT_DATA_BATTERY": "ROBOT/DATA/BATTERY",
  18. "ROBOT_DATA_POSITION": "ROBOT/DATA/POSITION",
  19. "ROBOT_DATA_PICTURE": "ROBOT/DATA/PICTURE",
  20. "BACKEND_ACTION_DRIVE": "BACKEND/ACTION/DRIVE",
  21. "BACKEND_ACTION_DRIVEALL": "BACKEND/ACTION/DRIVEALL",
  22. "BACKEND_ACTION_GETPOSITION": "BACKEND/ACTION/GETPOSITION",
  23. "BACKEND_ACTION_GETBATTERY": "BACKEND/ACTION/GETBATTERY",
  24. "BACKEND_ACTION_GETALLDATA": "BACKEND/ACTION/GETALLDATA",
  25. "BACKEND_ACTION_NEWPLANT": "BACKEND/ACTION/NEWPLANT",
  26. "BACKEND_ACTION_CONFIGUREPLANT": "BACKEND/ACTION/CONFIGUREPLANT",
  27. "BACKEND_ACTION_DELETEPLANT": "BACKEND/ACTION/DELETEPLANT",
  28. "BACKEND_ACTION_PLANTCOUNT": "BACKEND/ACTION/PLANTCOUNT",
  29. "BACKEND_DATA_SENSORDATA": "BACKEND/DATA/SENSORDATA",
  30. "BACKEND_DATA_SENSORDATAALL": "BACKEND/DATA/SENSORDATA_ALL",
  31. "BACKEND_DATA_POSITION": "BACKEND/DATA/POSITION",
  32. "BACKEND_DATA_BATTERY": "BACKEND/DATA/BATTERY",
  33. "BACKEND_DATA_PICTURE": "BACKEND/DATA/PICTURE",
  34. "BACKEND_DATA_PLANTCOUNT": "BACKEND/DATA/PLANTCOUNT",
  35. }
  36. # MQTT Messages:
  37. # region Robot -> Backend
  38. SENSORDATA = {
  39. "AirTemperature": 0.0,
  40. "AirHumidity": 0.0,
  41. "SoilMoisture": 0.0,
  42. "Brightness": 0,
  43. "PlantID": 0,
  44. "ActionID": 0
  45. }
  46. # TODO When sensor is available
  47. POSITION = {
  48. "Position": ""
  49. }
  50. BATTERY = {
  51. "Battery": 0.0
  52. }
  53. # endregion
  54. # region Backend -> Robot
  55. DRIVE = {
  56. "PlantID": 0,
  57. "ActionID": 0
  58. }
  59. # GETPOSITION -> no message needed
  60. # GETBATTERY -> no message needed
  61. # endregion
  62. # region Backend -> Frontend
  63. PLANTDATA = {
  64. "AirTemperature": 0.0,
  65. "AirHumidity": 0.0,
  66. "SoilMoisture": 0.0,
  67. "Brightness": 0,
  68. "PlantID": 0,
  69. "Timestamp": "",
  70. "MeasurementID": 0,
  71. "PlantName": ""
  72. }
  73. ALLPLANTDATA = [
  74. PLANTDATA,
  75. PLANTDATA,
  76. PLANTDATA,
  77. PLANTDATA,
  78. PLANTDATA,
  79. PLANTDATA
  80. ]
  81. # TODO When sensor is available
  82. POSITION = {
  83. "Position": "",
  84. "Timestamp": ""
  85. }
  86. BATTERY = {
  87. "Battery": 0.0,
  88. "Timestamp": ""
  89. }
  90. PLANTCOUNT = {
  91. "CurrenCount": 0,
  92. "MaxCount": 0
  93. }
  94. # endregion
  95. # region Frontend -> Backend
  96. DRIVE = {
  97. "PlantName": ""
  98. }
  99. NEWPLANT = PLANTDATA
  100. CONFIGUREPLANT = PLANTDATA
  101. DELETEPLANT = {
  102. "PlantID": ""
  103. }
  104. # DRIVEALL -> no message needed
  105. # GETPOSITION -> no message needed
  106. # GETBATTERY -> no message needed
  107. GETALLDATA = {
  108. "PlantNames": []
  109. }
  110. # endregion