Do you think it is possible / how might make XBee(s) self-configure based on what they see in the system?

So I have a home project I am working on. I will describe my project and then get to the question.

I have a network of 10 XBee’s successfully communicating and performing the same basic functions but in a position dependent sequence. Each XBee is permanently attached to a tower. So, there are 10 towers each with an XBee. These 10 towers communicate remotely with a coordinator module at the control panel. When not in use, the towers are on a rack in a closet. When they are in use a tower is randomly grabbed and push-to-connected into 1 of 10 ports. Do this with each XBee with the remaining push-to-connect ports. So here is the goal: I would like to make the network so that when a random XBee tower is connected to a random port the XBee “sees” that specific port and assumes that position’s specific functionality.
I have 2 solutions in mind:
1.) using Micropython and then tethering into Python: I2C bus of sensors running to each of the 10 ports. On an I2C bus each sensor has a unique address. So, when an XBee tower is push-to-connected, it would see the address of the I2C sensor and then run an if statement depending on the sensor’s address.
2.) power cycling… on/off power is manipulated in such a way that when one tower is ON, that tower knows the position that its in because only that tower was powered on… then that tower assumes that position’s functionality.

Any thoughts or suggestions on this problem? The primary question is below:

last but not least, is it possible to change the Node Identifier (NI) of an XBee module in python code?? Because right now I’m thinking the easiest thing to do with either of the proposed solutions is to essentially have a module push-to-connect into a port, see a position identification, and then change it’s own NI to the NI of that position’s functionality. In the code the positions are ordered by module NI order, i.e. module00, module01, module10, etc. Because originally the design was such that you had to put tower00 with module00 in port00. But I want to put towerXX with moduleXX into portXX and the system reconfigure itself accordingly. (All the XBees are doing the same basic functionality but in a different sequence based on their position)

It a cool project! thanks for any help or even just conversing about it


Either the first or the last would work. As long as you write the proper code for it.

How to send an input read from my i2c io expander from micropython to my python program?..

You need to do a Discover on the I2C port to see what devices are on it. This is a standard function of I2C and something you should be able to find in the I2C specification.