Tried with 9.0.2 and 8.2.4 I am getting a small number usually 3 log writes and then all subsequent log writes are blocked.
Are they working for you? If so Iāll give it another go when Iām back home it may have been some kind of server issue last night.
I donāt use these from Farmware, but theyāre certainly working in v9.0.2 using CeleryScript RPC over MQTT.
Thisās why I would like to see your simple reproducer in Python3.
@whitecaps Weāve been able to perform movements on multiple devices via 9.0.2. I tried moving my bot and executing a sub-sequence just now and it appears to be working OK (via my.farm.bot). Are you self-hosting your device?
Please let me know if you have any other information available and I can look into the matter further.
Thanks @RickCarlino and @jsimmonds I will try again when I am back home on Thursday.
If I still have issue and Iām stuck, I will create and post a test python farmware script.
Hi @RickCarlino & @jsimmonds,
I am not self hosting yet. Iām not using the CeleryScript (probably a hang over from how I started out). I expect I am getting something very basic wrong in calling Farmware-tools because the Farmware code is quite old.
Below is some test code just a modified Hello Farmware, this used to work in FBOS 7 and I think I saw it working on 8 but maybe something has changed.
from farmware_tools import app
from farmware_tools import device
from farmware_tools import env
from farmware_tools import get_config_value
try:
device.move_absolute(
{
ākindā: ācoordinateā,
āargsā: {āxā: 100, āyā: 100, āzā: 0}
},
100,
{
ākindā: ācoordinateā,
āargsā: {āxā: 0, āyā: 0, āzā: 0}
}
)
INPUT_VALUE = get_config_value(farmware_name=āHello Farmware Inputā, config_name=āinputā, value_type=str)
device.log(message=āHello Farmware! Input was: {}ā.format(INPUT_VALUE), message_type=āsuccessā)
except Exception as error:
device.log(repr(error))
When I run this I get no movement but get the message output so it is calling Farmware-tools. No error is logged. I have also noticed the Farmware page doesnāt update when you remove the Farmware and there is still a FarmwareToolsVersion field showing which is no longer part of the manifest contract these are obviously low priority errors.
Thank you for any help!
@whitecaps, a caveat up-front : of all the languages out there, Python and I just donāt get along.
Do you know that only Python 3 is supported for Farmware coding . . I think that applies from v8 up, but @RickCarlino is the authority.
Your code as posted wouldnāt execute. I had to change it to this to make it work
from farmware_tools import app
from farmware_tools import device
from farmware_tools import env
from farmware_tools import get_config_value
try:
device.move_absolute(
device.assemble_coordinate(100, 100, 0),
100,
device.assemble_coordinate(0, 0, 0))
INPUT_VALUE = get_config_value(farmware_name="wc-farmware", config_name="input", value_type=str)
device.log(message="Hello Farmware! Input was: {}".format(INPUT_VALUE), message_type="success")
except Exception as error:
device.log(repr(error))
@jsimmonds thank you! I will give that a go. I didnāt need to call assemble_coordinate in the past. I saw that method in the latest farmware-tools and I should have given it more thought, was very tired today . Iām not great at python as well lol.
Unfortunately there is something else going on as your code isnāt working. The Farmware page is not updating if I remove, update or delete all Farmware data, so I think thereās a bigger issue here. I think I will have to debug it (https://developer.farm.bot/docs/common-farmware-problems). Itās just starnge it worked before and not now. I may also have to do a factory reset just in case my user data has somehow been corrupted.
Ran into the same issue yesterday. This looks like a WebApp/OS based issue. When a farmware is deleted by pressing the ādeleteā button, its still shown in the farmwares list but when clicking any farmware button like run, update or delete, a toast message pops up saying that the farmware is not installed.
CC: @RickCarlino - Any idea on that?
Hi @jsimmonds @Ascend @whitecaps,
I will take a look at this matter today. Thank you so much for all the detailed code samples.
Hi @whitecaps @Ascend @RickCarlino !
I also saw the same poor behaviour on the Farmware page when trying to remove 3rd party Farmwares but forgot to mention that.
@whitecaps, you should be able to change the manifest.json item āpackage_versionā to a value that youāve not used before, zip it all up, and then press UPDATE
to install the package with your latest changes, provided that your Farmware server URL hasnāt changed.
Otherwise, just try changing the Farmware name and then INSTALL
-ing as a new package.
( I had to use both methods )
Iām not sure that your original Python code is āwrongā or just not Python3-compatible . . Iām just not familiar enough ( or bothered enough to make the effort to learn right now )
I definitely have that code sample that I posted working ( move and INPUT ) on FBOS v9.0.2
Thatās what I am doing . I can definitely upload the code but some functions arenāt working for some reason. I need to look further into it.
Iām not sure if my move_absolute statement was wrong either. I have just changed back from mac to pc after a few years and need to sort out a better python IDE than sublime .
@jsimmonds I really appreciate your help!!!
Youāve given me courage to analyze why your initial code post wonāt execute.
This means me learning a lot more about Python. Apparently, indentation and case are meaningful in Python so I should feel āat homeā . . ( e.g. Ruby and CoffeeScript . . my fave )
Thanks
P.s. That Mac back to PC transition ā¦ hmmm, I can relate to that. When Apple ā¢ stopped supporting my beautiful MacBook Pro ( Intel Core2 Duo ) after Lion because āmy hardware was too oldā I spat out that Apple core and bit the PC bullet. Itās an ongoing disappointment.
@whitecaps , the quick way to see Python failures in Farmwares is to connect to your FarmBotās Raspberry Piās serial console using a TTL-232-RPi ( FTDI ) cable ( or similar ).
@whitecaps
I just took a look at your code and found a few small mistakes. The main reason that your farmware didntāt work, was probably that your āargsā in the manifest.json was pointing to a false python file. I linked the comparison to my fork right here. I guess with that mistake you always ran the original āHello Farmware Inputā script that was still saved and didnāt contain your changes.
Iāve also tried different versions of device.move_absolute
since I wasnāt sure if the short version also works, and it does.
Yup I copied that over from farmbot labs to create the test code and neglected to change that. Iām back home later today and will give it another push tonight sort out my IDE and debug. Thanks again @Ascend and @jsimmonds. Will let you know how it goes.
Ok the argument path was it. Stupid sleepy mistake like I thought. I can now go and fix up my old python gridit code because I have a working test.
BTW @jsimmonds both ways of calling move_absolute work. I am going to use yours as itās cleaner.
Thanks guys!
Cool, @whitecaps . . good work.
The latest Developer docs suggest that
Farmware should only be used in cases when it would be impractical to
run software remotely, such as operations that require offline support
or extremely low latency.
@RickCarlino , which doc details precisely which āAPIā functions are available to an offline bot ?