Hello!
My setup is following:
-ConnectPort X4
-Xbee sensor adapter
-Watchport/H sensor
I have succeeded reading temperature and humidity from the sensor using “Use DDO to Read Temperature from XBee Sensor” example. But i dont want to poll the temperature, so i have set up “I/O sample rate (IR)” parameter to 5000ms in Xbee sensor adapter settings and also i configured my ConnectPort X4 address as destination. So now my xbee adapter is sampling every 5 seconds and sending the data, at least that is what i suppose its doing.
I have made following simple program to read the data:
import sys, os, time, myFunctions,zigbee,socket, xbee_sensor
running = True
sd = socket.socket(socket.AF_ZIGBEE, socket.SOCK_DGRAM, socket.ZBS_PROT_TRANSPORT)
sd.bind(('', 0xe8, 0, 0))
sd.settimeout(1)
while running:
try:
packet, source = sd.recvfrom(255)
print myFunctions.getRTCTime()
print packet
print source
print "Read %d bytes" % len(packet)
print "
"
except socket.timeout:
#Ignore the timeout exception
pass
except:
print "Unexpected error:", sys.exc_info()[0]
sd.close
running = False
this is what i get every 5 seconds:
2011-10-30 14:24:05
(‘[00:13:a2:00:40:6f:8c:1f]!’, 232, 49413, 146, 1, 0)
Read 8 bytes
How should I proceed to convert the data to human readable values. In this case temperature, sensor_rh and true_rh?
Juha