Hey there,
I’m trying to write a python-script to get some projector-stats to my ConnectPort X2,
via XBee-Pro RS232 Adapter.
The scenario:
ConnectPort X2 |- -| Adapter – Controller (RS232) – Projector
The controller sends every 2-3 seconds:
“Uf”
“o.”
If the controller receives a “ta”, during the , the controller sends the projector
information via RS232 to the XBee-Pro Adapter.
My Problem is, that I receive the “Uf” and “o.” messages at my gateway, but there are no further strings. What am I missing here?
Any help would be appreciated!
import xbee
from socket import *
import sys
# The Format of the tuple is:
# (address_string, endpoint, profile_id, cluster_id)
#
# The values for the endpoint, profile_id, and
# cluster_id given below are the values used to write
# to the serial port on an Ember-based XBee module.
# For 802.15.4 use 0,0,0
BEAMER = ("[0001]!", 0, 0, 0)
BEDIENFELD = ("[0010]!", 0, 0, 0)
#######################################
# Parse Args
#######################################
if sys.argv[1] == 'beamer':
RX = BEAMER
elif sys.argv[1] == 'panel':
RX = BEDIENFELD
# Create the socket, datagram mode, proprietary transport:
sd = socket(AF_XBEE, SOCK_DGRAM, XBS_PROT_TRANSPORT)
# Bind to endpoint 0xe8 (232) for ZB/DigiMesh, but 0x00 for 802.15.4
sd.bind(("", 0x00, 0, 0))
notSent = True
statustext = []
while(notSent):
buff, addr = sd.recvfrom(255)
print buff + "
"
if "Uf" in buff:
sd.sendto("ta", 0, RX)
while(notSent):
buff, addr = sd.recvfrom(255)
statustext.append(buff)
if "o." in buff and len(statustext) > 3:
notSent = False
print statustext
print "
"