how to send remote AT command to xbee device using python digi-xbee library

as the title said, i’m looking for a way to send an AT command to a remote xbee and read the response. my code is in python and i’m using digi-xbee library.

another question: my goal of using AT command is to get the node ID of that remote xbee device when this last one send me a message, i don’t want to do a full scan of the network, i just want to get its node id and obviously the node id doens’t come within the frame. so i had to send to it an AT command so he send me back its node ID. if you have any suggestions that may help, please tell me, i’m open to any helpful idea.

PS. i tried to use read_device_info() within the callback function that launch when a data received but it didn’t work. it works outside the function but inside no!

thanks in advance

In the callback, what you need is
“address = xbee_message.remote_device.get_64bit_addr()”
if you want to get the address of the sender.
And if you want to send back an AT command to the sender, for example, to set a pin to digital output high, use the local Xbee to send a RemoteATCommandPacket to the local.
Here is an example: (set D4 of remoted Xbee to high)

#make an AT Command Packet
ATcommand = RemoteATCommandPacket(1,address_of_remoted_Xbee,XBee16BitAddress.from_hex_string(“FFFE”),
#then send the packet from local_Xbee

Good luck!

Did it work, OP?

Your thoughts may be in order but when it comes to translating them to words on paper that have a flow and consistency as well as perfect grammar, this is beyond most students.

Your ideas might also be in order however when it comes to translating them to phrases on paper that have a waft and consistency as properly as ideal grammar.