Zigbee outlet module that will distinguish button press from remote activation?

If all you need is to have lights on or off with timer based on if motion is detected in a room and you have a door then add in a door sensor and use this blueprint to set your thresholds:

I use this with a motion sensor in my bathroom and the sensor on the door so that whilst there is motion detected the light stays on and after 5min of no motion the light is turned off.