Farmware call via MQTT

Hi all, would it be possible to call up a Farmware via MQTT?

1 Like

Yes, you can do that quite easily using the execute_script Celery Script node, by sending the command as you would any other over MQTT. This is the node the Run Farmware sequence step uses.

In Python:

import json
import paho.mqtt.publish as publish

# Prepare the Celery Script command.
command = {
    'kind': 'execute_script',
    'args': {'label': 'My Farmware'}}

# Send the command to the device.
publish.single(
    'bot/device_1/from_clients',
    payload=json.dumps(command),
    hostname='brisk-bear.rmq.cloudamqp.com',
    auth={'username': 'device_1', 'password': 'my_token'})

How silly I am :man_facepalming: I could have figured it out myself… thanks Gabriel :wink:

1 Like

Is there an “easy” way to setup my own MQTT broker to feed the PI (bot) with my own commands directly?
In the on-premise installation of the my.farmbot.io software I saw that it installs RapidMQ.

I like to replace this with my broker (if possible).
What I would need is:
how to change the MQTT “Hostname” in the PI?
What are all the possible topics/payloads the PI is expecting (I assume its documented somewhere but the code is quite large:))

Thanks,

have a look here https://farmbot-developers.readme.io/v6/docs/message-broker and search for MQTT in the forums. there is at least one thread about it.

If you need more help, come back :wink: