Python XBee Library ERROR when attempting to set the AP parameter in XBee device

I have an XBee3 ZigBee network setup. I have both firmware flashed (MicroPython) and a main Python project. So, my goal is to send a message on auto-start (PS = 1) with one of my router devices to the coordinator device.

First question is, in order for MicroPython to run at all do you have to have the device in REPL mode (AP=4)? or can you have it in API (AP=1) mode the whole time and thats fine? The MicroPython will run in API mode?

Separate more specific question:

So when I go to reset the AP parameter of the router device after the flashed firmware runs at auto-start I get an error… I want the router to initially be in REPL mode to run the firmware at auto-start correct?? so that’s AP = 4.

Then after that runs I want the device to be set as AP=1 (API mode)

So when I do:

remote_device.set_parameter(“AP”, bytearray(‘\x01’))

I get “TypeError: string argument without an encoding”

I tried this instead:

tower_1.set_parameter(“AP”, ‘utf8’, bytearray(‘\x01’))

same error…
what is the proper syntax to do this?

thanks much! :smiley:

In order to use Micro Python on the module with an app running on it, you do have to have the radio in Micro Python mode.

I have just been setting AT commands with something like (“AP”, 1) does that work for you?