How to, automatically, make all Xbee wake up/sleep when coordinator turns on/off?

Hi guys, I want to solve the following problem:

In my system I use API mode. I have 5 Xbees (1 coordinator) e 4 routers. The routers send samples every 50ms and never sleep. But, sometimes, the coordinator is manually turned off. The routers cannot be turned off manually (enclosed in a sealed box). So, I would like to make the 4 routers sleep when there is no coordinator on and awake them when the coordinator turns on again. Is there a way we can do this automatically?

The problem is that the coordinator might be turned off directly in the power, so there is no time to send an api command to make all xbee sleep.

Since you’re in API mode you should watch for the ZigBee Transmit Status (Frame ID 0x8B) for your outgoing messages. When the coordinator turns off those will begin to indicate a failure (most likely 0x24) that you can watch for. At that point you have a lot of options depending on what you’re trying to achieve by making them “sleep”.

Normally routers don’t sleep and you would need to make them End Devices. But if you need Routers you could lower just lower the transmit rate or power-them down.

In the power-down case power-up periodically and try to send a message to the coordinator. If it succeeds stay awake and revert back to the 50ms behavior. Otherwise power-down again. When the coordinator powers-on you’ll see routers turn on and stay on in a cascade taking longest to reach routers farthest away that need intermediate routers on to reach the coordinator.