In the event it isn't obvious, if you have your module and your motion sensor set to the same code, the motion sensor is turning on and off the module (wall switch, whatever). The door opens and someone walks into the pantry. P1 is the motion sensor. AHP sends P1on across your electric lines. The light goes on. Your dusk-dawn sensor sends P2, which gets sent down the powerline, but it's meaningless. When the motion sensor times out, it sends a P1off, which is sent down the powerline and turns off the pantry light. The dusk-dawn sensor sends a P2 which is ignored.
To make the macro work, set the motion sensor to a different code, say M1. Then have a macro triggered by M1 that turns on the pantry light.
Or you can remove the macro and leave your system as-is. One thing I like about that is that if you have several kids, at some point a favorite game will be to terrorize the youngest by locking them in the pantry and listening to them scream when the light automatically turns off. If the motion sensor directly controls the light, the child's presence will keep sending an On command, keeping the light on indefinitely.
I'm currently messing around with using macros and keeping all of my motion sensors on a transceived House Code. Look at the amount of activity they generate on your monitor when someone is inside the pantry. What I'm learning now is the logic behind programming my study light to come on and stay on, then go off when I exit, but to dim before going out so if I am still in the study hard at work I can wave my arms to re-trigger the light.
Have fun!
Rob