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.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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_DRIVEALL": "ROBOT/ACTION/DRIVEALL",
  15. "ROBOT_ACTION_GETPOSITION": "ROBOT/ACTION/GETPOSITION",
  16. "ROBOT_ACTION_GETBATTERY": "ROBOT/ACTION/GETBATTERY",
  17. "ROBOT_DATA_SENSORDATA": "ROBOT/DATA/SENSORDATA",
  18. "ROBOT_DATA_BATTERY": "ROBOT/DATA/BATTERY",
  19. "ROBOT_DATA_POSITION": "ROBOT/DATA/POSITION",
  20. "ROBOT_DATA_PICTURE": "ROBOT/DATA/PICTURE",
  21. "ROBOT_DATA_ERROR": "ROBOT/DATA/ERROR",
  22. "ROBOT_DATA_ROBOTREADY": "ROBOT/DATA/ROBOTREADY",
  23. "ROBOT_DATA_PICTURE": "ROBOT/DATA/PICTURE",
  24. "ROBOT_DATA_ALL": "ROBOT/DATA/ALL",
  25. "BACKEND_ACTION_DRIVE": "BACKEND/ACTION/DRIVE",
  26. "BACKEND_ACTION_DRIVEALL": "BACKEND/ACTION/DRIVEALL",
  27. "BACKEND_ACTION_GETPOSITION": "BACKEND/ACTION/GETPOSITION",
  28. "BACKEND_ACTION_GETBATTERY": "BACKEND/ACTION/GETBATTERY",
  29. "BACKEND_ACTION_GETALLDATA": "BACKEND/ACTION/GETALLDATA",
  30. "BACKEND_ACTION_NEWPLANT": "BACKEND/ACTION/NEWPLANT",
  31. "BACKEND_ACTION_CONFIGUREPLANT": "BACKEND/ACTION/CONFIGUREPLANT",
  32. "BACKEND_ACTION_DELETEPLANT": "BACKEND/ACTION/DELETEPLANT",
  33. "BACKEND_ACTION_PLANTCOUNT": "BACKEND/ACTION/PLANTCOUNT",
  34. "BACKEND_DATA_SENSORDATA": "BACKEND/DATA/SENSORDATA",
  35. "BACKEND_DATA_SENSORDATAALL": "BACKEND/DATA/SENSORDATA_ALL",
  36. "BACKEND_DATA_POSITION": "BACKEND/DATA/POSITION",
  37. "BACKEND_DATA_BATTERY": "BACKEND/DATA/BATTERY",
  38. "BACKEND_DATA_PICTURE": "BACKEND/DATA/PICTURE",
  39. "BACKEND_DATA_PLANTCOUNT": "BACKEND/DATA/PLANTCOUNT",
  40. "BACKEND_DATA_ERROR": "BACKEND/DATA/ERROR",
  41. "BACKEND_DATA_ROBOTREADY": "BACKEND/DATA/ROBOTREADY"
  42. }
  43. # MQTT Messages:
  44. # region Robot -> Backend
  45. SENSORDATA = {
  46. "AirTemperature": 0.0,
  47. "AirHumidity": 0.0,
  48. "SoilMoisture": 0.0,
  49. "Brightness": 0,
  50. "PlantID": 0,
  51. "ActionID": ""
  52. }
  53. ALLSENSORDATA = {
  54. "SensorData": [],
  55. "ActionID": ""
  56. }
  57. # TODO When sensor is available
  58. POSITION = {
  59. "Position": ""
  60. }
  61. BATTERY = {
  62. "Battery": 0.0
  63. }
  64. # endregion
  65. # region Backend -> Robot
  66. DRIVE = {
  67. "PlantID": 0,
  68. "ActionID": ""
  69. }
  70. DRIVEALL = {
  71. "PlantID": [0, 0], # List containing PlantIDs sorted ascending
  72. "ActionID": ""
  73. }
  74. # GETPOSITION -> no message needed
  75. # GETBATTERY -> no message needed
  76. # endregion
  77. # region Backend -> Frontend
  78. PLANTDATA = {
  79. "AirTemperature": 0.0,
  80. "AirHumidity": 0.0,
  81. "SoilMoisture": 0.0,
  82. "Brightness": 0,
  83. "PlantID": 0,
  84. "Timestamp": "",
  85. "MeasurementID": 0,
  86. "PlantName": ""
  87. }
  88. ALLPLANTDATA = [
  89. PLANTDATA,
  90. PLANTDATA,
  91. PLANTDATA,
  92. PLANTDATA,
  93. PLANTDATA,
  94. PLANTDATA
  95. ]
  96. # TODO When sensor is available
  97. POSITION = {
  98. "Position": "",
  99. "Timestamp": ""
  100. }
  101. BATTERY = {
  102. "Battery": 0.0,
  103. "Timestamp": ""
  104. }
  105. PLANTCOUNT = {
  106. "CurrenCount": 0,
  107. "MaxCount": 0
  108. }
  109. # endregion
  110. # region Frontend -> Backend
  111. DRIVE = {
  112. "PlantName": ""
  113. }
  114. NEWPLANT = PLANTDATA
  115. CONFIGUREPLANT = PLANTDATA
  116. DELETEPLANT = {
  117. "PlantID": ""
  118. }
  119. # DRIVEALL -> no message needed
  120. # GETPOSITION -> no message needed
  121. # GETBATTERY -> no message needed
  122. GETALLDATA = {
  123. "PlantNames": []
  124. }
  125. # endregion