I’m looking to make use of the Farmbot Broker to collect data from the system.
I want to associate plants with the soil moisture reading the Farmbot actions. I.e. the output message I’ll send to the broker is " {plant: 12 , soil moisture : 1020 } ". And every time the farmbot measures soil mositure for a different plant, I expect the plant number to change with it.
What is the best practice to achieve something like this?
My plan was to set up env variables for each plant i.e. env(“plant”,"12). Then in the sequence I would write LUA logic to
iterate through the env variables by altering the value in the env() call.
Create the farmbot action to take soil moisture at the plant location (well near to it)
send message to farmbot broker
Do you feel this would be necessary? Or am I overcomplicating things?
Hi @aeroptl yes, Farmbot resources are accessed via the REST Web API. (You could use curl cmdline)
The Lua api() function is probably the one to use. meta is a top-level object.
For fun, here is the JSON returned when I PATCHmeta.robot_visited value in a Weed using $ curl --header @jwt --data-ascii '{"meta":{"robot_visited":"2024-06-19T14:53:10.000+10:00"}}' --request PATCH https://my.farm.bot/api/points/297818 |json_reformat
Ahh okay, I guess with the lua api() function, I’d need to use method = “patch” to create new meta items for plant points and then use the GET method to extract all the plant point information for me to save elsewhere.
Thanks for your help. I’ll give this a try to understand how it works.