Well let me first state I have never even seen an apple tv so my advice could be for naught.
If I am understanding your problem correctly you only have one menu command and that just moves the menu one selection up or down (pending on when it reaches the home menu)
It would seem by logic that you would have to count how many menu options there are say there are 6 menu features available. You would need to think that if you were in that 6th position then you would need 6 presses of the menu key to get to home.
So I would build a global macro that did a 5sec pause transmission followed by a menu command. Then go to your "power off" macro and repeat this global macro for the worst case scenario (the number of menu choices there are)
This would send the pause command for each menu page and then send a menu command to move it to the next menu option.
This should work unless the apple tv wakes on pause or menu commands and if that is the case then I don't see a way around this.
One thing I have learned in this industry. It is easier to pull a wire than it is to push one.