from digi.xbee.devices import XBeeDevice, RemoteXBeeDevice, XBee64BitAddress
import serial
import logging
local_device = XBeeDevice("COM7", 9600)
data_send = ("\x33\x03\x75\x30\x00\x24\x5b\xc0")
try:
local_device.open()
remote_device = RemoteXBeeDevice(local_device, XBee64BitAddress.from_hex_string("0013A20041513885"))
local_device.flush_queues()
print("Sending data asynchronously to %s >> %s " % (remote_device.get_64bit_addr(),data_send))#printing MAC add.
local_device.send_data_async(remote_device, data_send)
print("Success")
print("Waiting for data...\n")
xbee_message = local_device.read_data()
if xbee_message is not None:
print("From %s >> %s" % (xbee_message.remote_device.get_64bit_addr(),
xbee_message.data.decode()))
finally:
if local_device is not None and local_device.is_open():
local_device.close()
I am trying to send modbus hex command (33 04 75 30 00 24 5b c0)
through python for zigbee module. But, instead off sending command in hex its sending in ascii. Can anyone solve this problem. I am using digi-xbee module in python which uses pyserial for serial comm. here is my code which i am trying to send. data_send = ("\x33\x03\x75\x30\x00\x24\x5b\xc0")