February 2, 2021 Software Update

Hi all,

Today we deployed a new version of FarmBot OS (v12.3.4) as well as new features to the web app. Here’s what’s new:

First-class Lua support

As mentioned in the last update, we’re committed to empowering 3rd party developers and advanced users in taking greater control of FarmBot with custom code.

Starting today, once you upgrade to FBOS v12.3.4, you’ll find a new LUA sequence command available in the app. This command allows you to insert Lua code fragments into your sequences in a standalone fashion, or intermixed with standard commands and subsequences.

lua

Our Lua sandbox currently supports a variety of useful FarmBot helpers which you can learn about in our updated developer documentation. In addition, you can access most of the functions available in the Lua 5.2 standard library.

Over the coming months we plan to add additional functionality and we encourage you to let us know here on the forum what you would like to see added!

Monaco editor

To help create a better development experience, the new Lua command, as well as the Assertion command, now feature a Monaco text editor with Lua syntax highlighting. You can toggle between this editor and a plain text field using the “A” icon.

Updated help panel

To help users help themselves, we’ve updated our help panel to embed our software documentation and developer documentation right in the app!

4 Likes

What an incredible time to return to this community. I just moved to Perth and I’m moving into my new home next week. I can’t wait to finally use my Farmbot that I purchased many years ago (v1.2).

As a programmer, I am super excited to see Lua support.

I also remember being asked years ago what I thought about a DSS (decision support system) for farmbot. Has there been any progress on that front?

One thing I would love to develop is an integration with a local weather API. I want to check if it has rained or is going to rain before running watering sequences.

4 Likes

Welcome back, @mdingena! Long time no see :smiley:

If you want some features added to the Lua sandbox, please let me know. New features can be added to the Lua sandbox much faster than the visual editor. The only caveat is that we are planning to eventually make sequences (and their Lua snippets) publicly shareable, so we do need to keep the sandbox… sandboxed (Ie: no direct shell access)

Unfortunately not. The team is still small (slightly smaller than before) and we have had to shelve that idea for higher priority features.

This is a good idea :thinking:. It might be possible to add this to the Lua sandbox, though we would need to find a weather API that is free for self-hosted users. I will make a note of this feature request.

Does anyone know a good place/tutorial for a beginner to learn Lua from scratch?

@ClosedCircuit There is the “authoritative tutorial” and a decent-looking short tutorial here (assuming you are already familiar with programming concepts).

Lua most resembles Javascript IMHO, so if you’ve already worked with JS, the transition should be relatively straightforward.

1 Like

Looking forward to trying to move as much of my python Farmware code to Lua. Huge step forward. I’ll let you know how it goes.

If possible can you keep Farmware going, I’m just unsure whether people will be able to migrate everything.

@RickCarlino can you call out to external APIs using this method?

@whitecaps

We have hidden it from the UI on accounts that do not actively use farmware and do plan to remove it entirely eventually. The feature is essentially dead at this point, but I don’t have plans to fully remove it until I have a reason to do so. For example, the firmware system caused a huge CPU slowdown on Express models late last year, so I had to remove a portion of the farmware runtime. If that happens again, I may need to remove more pieces.

With that being said, adding features to the Lua sandbox is fairly straightforward, and if you want to see a feature added, I’d be happy to discuss it.

I want to but haven’t started yet. This would be very useful for downloading weather reports from APIs like http://wttr.in.

If we did, what sorts of HTTP features would you need? I assume you are trying to talk to some JSON REST API? Please PM me real-world use cases if possible.

Integrating FarmBot with:

  • Discord
  • Slack
  • Telegram
    to push its log messages.

Integrating FarmBot with external APIs to use as a decision support system.

Those are the two major ways I would use HTTP functionality.

1 Like