Farmware to switch camera


I want to make a simple farmware that will switch between USB camera and raspberry PI camera.

I can’t find a resource which would allow me to do that, I looked through Web App API resources., FarmBotJS BotStateTree as well as celery script documentations.

None of those seem to provide option to switch camera configuration.

Is this possible to do in farmware?



Currently the camera selection is stored in user_env of the bot state tree. In general, farmware_tools.device.set_user_env can be easily used from within a Farmware to modify user_env values. While verifying this was possible for this particular value, I created this Farmware.


wow, thanks a lot! I am just wondering - how can I possibly figure out what are the various user env values?

If I ran help(farmware_tools.device) from python console, I just got

    set_user_env(key, value)
    Send command: set_user_env.
        key (str): ENV key
        value (str): ENV value

If I understood it right, farmware is executed on FB’s raspberry pi is that right? I would like to “play” with my farmware code in my IDE (pycharm) and only then upload it and try excuting it on my bot - is this possible?

You can see all the values by viewing them in the bot state. One way to do this is via the JavaScript console in the browser: store.getState().bot.hardware.user_env. In the future, these values will be stored in the API and available via HTTP.

For anyone who would find this useful - I just finished my first farmware :slight_smile:

This allows to switch camera between USB and RPI camera, based on the input provided to farmware / from within the sequence

thanks @Gabriel for help!


Can you put that on your github linklist @Gabriel? :wink: