Xbee Digi DIO adapter sleep mode

hi… i’m using Digi Xbee Digital DIO adapter with ConnectPort X4 to monitor door open-close status… i’m using magnetic switch with external power supply which is connected to Pin 0 adapter…

the adapter is powered up using N-cell battery as it’s located in isolated place… to ensure the adapter last longer, i set my adapter to sleep every minutes to check the status… the configuration is as below:

IR- 512
WH-125
SP-2000ms
SN-3
SP-4

i’m using simple Python script to read the Pin 0 status… but the problem is, most of the time, the ConnectPort doesn’t manage to read the adapter (ValueError)… i’m not sure either my code is incorrect or my configuration goes wrong…
my code is as below:

try:
digital_sensor = xbeedin.XBeeDIN(DESTINATION)
digital_sensor.configure(0, xbeedin.Input)
digital_sensor.power(1)
sample = digital_sensor.sample(0)

    if sample == 1:
        currentstatus = 1
        laststatus = 1
            
    if sample == 0:
        currentstatus = 0
        
    if currentstatus == 0 and laststatus == 1:
        laststatus = 0
       print "wachaa"
        time.sleep(1)

        
        
except ValueError:
        sample = "ERR_REPETUER"
        print sample
        time.sleep(1)
        
        
except TypeError:
        sample = "ERR_REPETUER"
        print sample
        time.sleep(1)

thanks…