[Farmware] Finding Tool Id?


#1

Working on Farmware that will seed a standard 1020 tray. At the start of the program I will have my FarmBot pick up the Seeder tool. I could just specify the exact coordinates in celery script but I’d like to specify the tool id instead. This appears to be an option but I don’t think my tool id’s are correct. Currently I am assuming that the slot id is the tool id but this seems wrong.

My question is: how do I find tool ids?


#2

I assume you are writing Celery Script similar to:

{
  "kind": "move_absolute",
  "args": {
    "location": {
      "kind": "tool",
      "args": {
        "tool_id": 1
      }
    },
    "offset": {
      "kind": "coordinate",
      "args": {
        "x": 0,
        "y": 0,
        "z": 0
      }
    },
    "speed": 100
  }
}

You can find the tool_id by running the following in the JavaScript console (to view the data for each of your tools):

JSON.stringify(Object.values(store.getState().resources.index.references).filter(x => x.kind.includes("Tool")).map(x => x.body))

or making a GET request to /api/tools:

import requests

API_TOKEN = 'my token'
headers = {'Authorization': 'Bearer ' + API_TOKEN,
           'content-type': "application/json"}
response = requests.get('https://my.farmbot.io/api/tools', headers=headers)
tools = response.json()

Find the tool with the desired name and use the corresponding id value for tool_id.


#3

Used the console method and it gave me exactly what I was looking for, thanks! Here are the results if anyone is curious: