Lua and knowing what tool is already mounted

Hi all,

is there a way in Sequences to know what tool is already mounted?
eg. if tool is not seeder run unmount then mount seeder. else none.
im guessing its somthing that needs to be done in LUA as i cant see how it can be done in IF at this time.
and at end of planting all seeds. unmount.
atm it mounts seeder. picks up seed. plants it. unmount. and repeat.
trying to get it to mount plant all seeds then unmount.


For a specific garden task, it is a best practice that during a specific sequence the tools are mounted, the task is performed, and then the tool is dismounted when the task is completed, and then the FarmBot returns to home. This way you can always start a sequence knowing that your FarmBot is at the home position and that all the tools are mounted and ready to go for the next task.

Other than in the software keeping track of which tool is mounted, there is no way to know which tool is already mounted. Tool verification is just a simple circuit that closes when the tool is mounted to the UTM.

The tool verification only tells the user if a tool is currently mounted.

Please review this page:

Use a READ SENSOR command to read the Tool Verification sensor using the Digital MODE. This will allow FarmBot to check if the tool has been successfully mounted.

read tool verification pin step

For the Lua approach, you could try using an ASSERTION sequence command (instead of IF):

 -- Fetch the list of tools from the API
 tools = api({method = "get", url = "/api/tools"})
 -- Get the mounted tool ID
 mounted_tool_id = get_device("mounted_tool_id")
 -- Find the mounted tool in the list of tools
 mounted_tool = nil
 for _, tool in ipairs(tools) do
   if == mounted_tool_id then
     mounted_tool = tool
 -- Check the name of the mounted tool
 if mounted_tool and == "Seeder" then
   return true
 return false

For the IF TEST FAILS field, select “Recover and continue”, and for the RECOVERY SEQUENCE field, select “Mount Seeder”, where “Mount Seeder” is a sequence that mounts the Seeder tool to the UTM.