hi ,
i have 2 xbee S1 linked , send receive is ok via xctu and my python program .the only issue is my push button (connected to one of the xbees set in DIOo) when pressed i get the api frame (change detect) via xctu but not in my python program , althought it’s a loop listening for all incoming data (i have tried a basic python serial listen port is ok and also all kind of terminals are receiving the data)
XBee setup
self.serial_port = "COM10"
self.xbee_device = XBeeDevice(self.serial_port, 1200)
def start_xbee(self):
try:
self.xbee_device.open()
print("Device serial port opened successfully.")
print("Waiting for data...")
while True:
xbee_message = self.xbee_device.read_data()
xbee_device.read_data() suppose to receive any kind of data (it works with sending manually frame from xctu) the only data i don’t receive is when change detect of the remote xbee occurs (even i see the same data from other apps (xctu, terminal, and even pyserial))
the pb is for sure the way the library xbee_device.read_data() works (maybe flow control) i dont know really i’m stuck
yes i do
# XBee setup
self.serial_port = “COM10” # Replace with your port
self.xbee_device = XBeeDevice(self.serial_port, 1200)
def start_xbee(self):
try:
self.xbee_device.open()
print("Device serial port opened successfully.")
print("Waiting for data...")
while True:
xbee_message = self.xbee_device.read_data()
if xbee_message:
deviceid = str(xbee_message.remote_device.get_64bit_addr())
rssi_bytearray = xbee_message.remote_device.get_parameter("DB")
rssi = int.from_bytes(rssi_bytearray, byteorder='big') # Convert bytearray to int
print(f'Message from ID: {deviceid}, RSSI: {rssi}')
time.sleep(0.1)
except Exception as e:
print("Error:", e)
No I was running basically with 57600 then I tried many rates (including 9600) to see if reducing baud rate will fix that
Anyway the com is working fine since with the same code I receive api if I send it manually with xctu only dio change detect api ( tx 83) is not working while this same api is received if I use terminal or serial read ()