Asking for farmbot --> client help using python & mqtt

Hi there,

I am programming the farmbot using mqtt messages in python. Sending mqtt messages is already tested and working, but i have some trouble getting back messages/events from the farmbot. Right now am using timers to wait for the farmbot to finish moving, of course i want this to change so that i only have to wait till the farmbot has finished moving and send back some form of confirmation through events. Could anyone help me with this? Or has anyone some example code?


Have you subscribed to the device MQTT channel (for example, bot/device_23/from_device)? In the bot status there is a busy flag you can use to determine if FarmBot is done moving. You could also check the location_data. You may also be able to use the Movement complete. log, depending on your needs.

Would you give me an example for how i could do this in python?

@NiekN Sure! I wrote some quick examples for you here:

In the future, I would like to write a Python wrapper to simplify the process (simiar to the Javascript wrapper, FarmbotJS-

I explain this one in the CeleryScript documentation. Basically, you will need to keep track of the label property.

The process works like this:

  1. You send farmbot an RPC command with a unique label
  2. Once the message is sent, your program can do other things.
  3. When you receive a message from FarmBot, you check the message’s label against all the label values that you sent.
  4. If the label matches a label that you sent, you now know that the message was received by FarmBot.
  5. You can check the bot/device_xyz/status channel for state changes that may have resulted from your command.

Please let me know if this helps clear things up.

@Gabriel @RickCarlino
Thank you both very much!
I got it working thanks to your example and the explaination given.
Regards, Niek

1 Like