I am using XBee PRO S3B for wireless radio communication.
Currently I am configuring it by XCTU, however, sometimes I need to reset or re configure with non graphical interface.
Using digi module with python seemed good alternative to me. So here is my source code.
import digi from digi.xbee.devices import XBeeDevice xbee0=XBeeDevice("/dev/ttyUSB0",9600) xbee0.open(force_settings=True) xbee0.reset()
In this way I can reset my destination mac address. However, there is one critical drawback using this method. xbee0.open()
is only supported by API mode, however, I am always using AT mode. So the command force_settings=True
enables my AT mode to change into API mode, however, I am not sure how can I get back to AT mode. My device only works with AT mode so I need to go back to AT mode to do something. Is there any good solution for this?
Advertisement
Answer
from digi.xbee.devices import XBeeDevice from digi.xbee.models.mode import OperatingMode xbee0=XBeeDevice("/dev/ttyUSB0",9600) xbee0.open(force_settings=True) xbee0.reset() xbee0.set_parameter(('AP'),bytearray([OperatingMode.AT_MODE.code]))