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

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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. POSITION = {
  58. "Position": ""
  59. }
  60. BATTERY = {
  61. "Battery": 0.0
  62. }
  63. # endregion
  64. # region Backend -> Robot
  65. DRIVE = {
  66. "PlantID": 0,
  67. "ActionID": ""
  68. }
  69. DRIVEALL = {
  70. "PlantID": [0, 0], # List containing PlantIDs sorted ascending
  71. "ActionID": ""
  72. }
  73. # GETPOSITION -> no message needed
  74. # GETBATTERY -> no message needed
  75. # endregion
  76. # region Backend -> Frontend
  77. PLANTDATA = {
  78. "AirTemperature": 0.0,
  79. "AirHumidity": 0.0,
  80. "SoilMoisture": 0.0,
  81. "Brightness": 0,
  82. "PlantID": 0,
  83. "Timestamp": "",
  84. "MeasurementID": 0,
  85. "PlantName": ""
  86. }
  87. ALLPLANTDATA = [
  88. PLANTDATA,
  89. PLANTDATA,
  90. PLANTDATA,
  91. PLANTDATA,
  92. PLANTDATA,
  93. PLANTDATA
  94. ]
  95. POSITION = {
  96. "Position": "",
  97. "Timestamp": ""
  98. }
  99. BATTERY = {
  100. "Battery": 0.0,
  101. "Timestamp": ""
  102. }
  103. PLANTCOUNT = {
  104. "CurrenCount": 0,
  105. "MaxCount": 0
  106. }
  107. # endregion
  108. # region Frontend -> Backend
  109. DRIVE = {
  110. "PlantName": ""
  111. }
  112. NEWPLANT = PLANTDATA
  113. CONFIGUREPLANT = PLANTDATA
  114. DELETEPLANT = {
  115. "PlantID": ""
  116. }
  117. # DRIVEALL -> no message needed
  118. # GETPOSITION -> no message needed
  119. # GETBATTERY -> no message needed
  120. GETALLDATA = {
  121. "PlantNames": []
  122. }
  123. # endregion