Home/Support/Support Forum/Xbee Digi DIO adapter sleep mode
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

Xbee Digi DIO adapter sleep mode

0 votes
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..
asked Jun 23, 2015 in 3rd Party Python and API development in other Languages by shahrule New to the Community (0 points)

Please log in or register to answer this question.

...