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.

data_functions.py 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. """
  2. created by caliskan at 19.04.2023
  3. This file contains all functions, which handle the different cases.
  4. Every function should return json format with the wanted data from the database
  5. """
  6. import paho.mqtt.client as mqtt
  7. from plantdatabase import PlantDataBase
  8. from software.defines import Topics
  9. # Robot Channel Reactions
  10. def data_sensordata(client: mqtt.Client, userdata, message: mqtt.MQTTMessage):
  11. print("message received")
  12. # TODO: Store data in database
  13. pass
  14. def data_position(client: mqtt.Client, userdata, message: mqtt.MQTTMessage):
  15. # TODO: Publish as json
  16. pass
  17. def data_battery(client: mqtt.Client, userdata, message: mqtt.MQTTMessage):
  18. # TODO: Publish as json
  19. pass
  20. # FrontEnd Channel Reactions
  21. def action_drive(client: mqtt.Client, userdata, message: mqtt.MQTTMessage):
  22. client.publish('Robot/Action/Drive', message.payload).decode("utf-8")
  23. def action_getposition(client: mqtt.Client, userdata, message: mqtt.MQTTMessage):
  24. client.publish('Robot/Action/GetPosition')
  25. def action_getbattery(client: mqtt.Client, userdata, message: mqtt.MQTTMessage):
  26. client.publish(Topics.drive)
  27. def action_getalldata(client: mqtt.Client, userdata, message: mqtt.MQTTMessage):
  28. # TODO: get data from database
  29. pass