February 10, 2021 Software Update
Today we released a new version of FarmBot OS (v12.3.6) as well as the web app. Here’s what’s new:
New Lua functions
In our ongoing effort to empower 3rd party developers with a powerful and easy way to extend the functionality of FarmBot with custom code, we’ve implemented some additional and highly requested features to the Lua sandbox.
First up is
env(). By calling
env(key, value) you can store a key/value pair to disk. This information will be stored on the device SD card and eventually synced to your web app account. By calling
env(key) you can retrieve a previously stored value. This can be used to store long term data such as an API token for a 3rd party service you wish to access, or short term data that you wish to persist and use in other sequences/subsequences.
Next up is
http(). As you may have guessed, this function allows you to make http requests to 3rd party services such as weather APIs, messaging platforms, another device on your local network, etc. To help you get started @RickCarlino has written up an example for sending a message to a Slack channel.
json.decode() functions convert a Lua variable into stringified JSON and back again.
take_photo() takes a photo using the device camera.
For additional information and code examples, see our updated developer docs.
In addition to programmatically setting key/value pairs using
env(), there is a new section in the settings panel where you can view, add, edit, and delete key/value pairs from your account, which will then sync to the FarmBot. To access this section, go to the settings panel and type “env” into the search field.
New controls panel buttons
Rather than having to choose between going to home and finding home for the home button behavior, we’ve removed that app setting and are now permanently displaying both buttons all of the time.
You’ll now also find a three-dot menu next to the X-AXIS, Y-AXIS, and Z-AXIS labels. Clicking this reveals a popup with controls to FIND HOME, SET HOME, and FIND LENGTH for an individual axis, sparing you from diving into the settings panel for these commonly used functions.
- Added a link to the Lua developer docs to the Lua and Assertion step tooltips.
- Fixed a bug where sequence step buttons were overflowing incorrectly on small screens.