Help with end device and gateway communication

Hello,

I am still fairly new to Zigbee and to python but I am trying to make a network that allows the gateway to send a message to all the end devices requesting the sensor data. The network is flexible and could also allow just listening to the end devices to transmit every so often. So the real question is how to either send out a message to all end devices to request information or how to analyze periodic received packets? The network is currently just at one node for a proof of concept and we have implemented the home automation profile. The nodes can see each other and are talking but now I need to expand the capabilities.

From the python end, here is what I know so far. I know that I can create a socket on the gateway to the MAC of the end device and send information that way. What I am not sure of is how to read the data that comes back in or how to wait and read any data packets that are coming in? I also am still trying to figure out how to handle clusters and end points.

Probably a very newbish question but any help or direction would be appreciated.