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 3.5KB

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