POST Request for watering

I would like to ask a question, regarding the POST request for watering.
This is my POST Request:

When I execute it and type in the {“plant_id” = 2}, which is existing, then I get as a response TRUE and that’s it. In the FarmBot page itself nothing is moving…
And the information that I used is from:

So, I assume is correct the request…
Should I expect the post response that is shown there?
Also, what should I expect from the FarmBot side/ page?

I would be really thankful, if someone out there help me!! :disappointed_relieved::confused:

1 Like

To begin with, please surround your code with ``` to format it as a code block, like this:

def foo():

Please also delete your JWT before posting. You can use something like this for posting code:

API_TOKEN = 'my token'
headers = {'Authorization': API_TOKEN, 'content-type': 'application/json'}

As for your main concern,

See the post for details.

In other words, you can create plants, sequences, and farm events using the API (just as you can do in the web app), but to sync that data so that the device can use it, or to send a command and have FarmBot move, you will need to use MQTT.

For information about the web app workflow, see the software documentation. If you have any questions about creating data using the API with Python, please let me know.

Thank you, can you maybe give me information about the broker (server), so I use the mqqt and it willl work? I cannot find it anywhere…

Well, I found it, and it is giving me only “retry… retry…retry…” when I am trying through the MQTT. How is that possible? Does not sound right.
@Gabriel @RickCarlino


A few questions:

  1. Which MQTT client are you using?
  2. When you logged into the MQTT broker, what did you use as your username and password? Please use your email as a username and an API token as the MQTT password if you have not already (I will update the documentation to make this more clear).
  3. What port / host settings are you passing to the MQTT client?

I hope that helps! If it still does not work please let me know and I can help debug the issue further.

I am excited to see what you build.

Well, yeah, I am ausing the right password and user name. for the mqtt i am passing the one that is given into the famrmbot page. I also tried to use this: bot/device_{ }/from_clients no success… as a bot id i used the one on our page that is on the right corner, after you click settings… i also tried with the bot_id - the nam, given:
"bot": "aa7bb37f-5ba3-4654-b2e4-58ed5746508c"
no success at all - still getting at the mqtt - retyring… retrying…


Ok, I think I see the issue. Please try using the registration email as a username and the API token as a password. The device ID (for bot/device_123/from_clients) will follow the format of device_123.

I have written some documentation to clear a few things up. Please let me know if it helps (or if I need to add more information).

Which MQTT client library are you using?

As I already said I am using the right credentials (credentials, by means of email and password)…the problem is coming after that

@petya Which MQTT client are you using?

I am using the mqttfx, after logging in
in which I write ‘FarmBot’ and then click the ‘connect’ button
in the field next to publish, I can see home/garden/fountain

if i check: i see a msg that the mqqt broker is running, but actually is not?
and nothing is showed in the mqqt.fx window :confused:

To view MQTT messages after successfully connecting to the broker, you will need to subscribe to the relevant topic. Please review the documentation for more information.

@petya Earlier today @Gabriel wrote this quick python script for device_10:

import json
import paho.mqtt.publish as publish
message = {
    "kind": "send_message",
    "args": {
        "message": "Hello World!",
        "message_type": "success"
        'username': '',
        'password': 'my token'

Please note that spelling errors in channel names will result in disconnection. Perhaps MQTTfx is trying to connect to a channel it is not authorized to use?

What benefit is there in requiring messages to be manually published instead of the API taking requests and automatically publishing them?

This topic is about developing an integration for FarmBot that would talk more directly to the device rather than using the web app. If using the web app, you could simply add a Send Message step in a sequence, and the message would be sent upon execution of the sequence. Other options are also available, such as using the API to save a message directly to the database or sending a message from a plug-in on the device.