Python, XBee3: How to get an “add_packet_received_callback(my_packet_received_callback)” to stop after first reception.
right now I have it in a while loop like so:
while True:
# Add the callback.
local_device.add_packet_received_callback(my_packet_received_callback)
time.sleep(2)
#
local_device.del_packet_received_callback(my_packet_received_callback)
This is triggered because on my xbee router device the join notification is enabled (JN=1)
When it receives the api packet it runs the callback function.
Right now it seems to trigger multiple times during the notification sending process from the router device .i want it to just receive one packet and then stop.
using the delete callback worked for a different callback I used recently… but for this one it doesn’t seem to receive ONE packet, do what I want and then stop and wait for a different packet… instead it triggers when it gets the notification packet, and then keeps getting triggered by the same notification packet.