Tried posting this yesterday, but I guess it didn’t post or something.
Anyway I’m trying to read properties out of an S3B module using the digi-xbee python library and it works if I call it right after instantiation, but not if I try it after a packet is received.
I create the S3BDevice Object with my serial port, I can read data packets from remote S3B devices, but when I try and read the ID property from the modem it times out.
Important bits of the code ncdModem.device is DigiMeshDevice(serial_port, baud_rate):
SERIAL_PORT = “/dev/cu.usbserial-AI02QZQZ”
BAUD_RATE = 115200
#this is function is the callback that I pass into the NCDEnterprise module during
#instantiation. The module uses the Digi XBee module which runs on another thread.
def my_custom_callback(sensor_data):
# print('full return: '+ str(sensor_data))
#This call does not work
print(ncdModem.device.get_parameter(“ID”))
if(sensor_data[‘mode’] == ‘PGM’):
print(str(sensor_data))
if(sensor_data[‘sensor_type’] == 24):
# send_configuration_command()
print('full return: '+str(sensor_data))
for prop in sensor_data:
print(prop + ’ ’ + str(sensor_data[prop]))
if(sensor_data[‘mode’] == ‘PGM’):
print(sensor_data[‘source_address’])
#instantiate the NCDEnterprise Object and pass in the Serial Port, Baud Rate,
and Function/Method object
ncdModem = NCDEnterprise(SERIAL_PORT, BAUD_RATE, my_custom_callback)
#This call works
print(ncdModem.device.get_parameter(“ID”))