Skip to content

IS Response not parsing correctly? #69

@mypiandrew

Description

@mypiandrew

Hi

Running the current version against a S8 868LP Module

This code :


# Import and init an XBee device
from xbee.thread import XBee
import serial

ser = serial.Serial('/dev/ttyAMA0', 9600)

# Use an XBee 802.15.4 device
xbee = XBee(ser,escaped = True)

# Blink LED
xbee.remote_at(   frame_id='1',
                  dest_addr_long='\x00\x13\xA2\x00\x41\x87\xB5\xD4',
                  options='\x02',
                  command='P8',
                  parameter='\x05')

xbee.remote_at(   frame_id='2',
                  dest_addr_long='\x00\x13\xA2\x00\x41\x87\xB5\xD4',
                  options='\x02',
                  command='P8',
                  parameter='\x04')

xbee.remote_at(   frame_id='3',
                  dest_addr_long='\x00\x13\xA2\x00\x41\x87\xB5\xD4',
                  options='\x02',
                  command='P8',
                  parameter='\x05')

# Analogues AD0-AD3
xbee.remote_at(   frame_id='4',
                  dest_addr_long='\x00\x13\xA2\x00\x41\x87\xB5\xD4',
                  command='D0')

xbee.remote_at(   frame_id='5',
                  dest_addr_long='\x00\x13\xA2\x00\x41\x87\xB5\xD4',
                  command='D1')

xbee.remote_at(   frame_id='6',
                  dest_addr_long='\x00\x13\xA2\x00\x41\x87\xB5\xD4',
                  command='D2')

xbee.remote_at(   frame_id='7',
                  dest_addr_long='\x00\x13\xA2\x00\x41\x87\xB5\xD4',
                  command='D3')

# Dig In D4,D6,D7 & D11
xbee.remote_at(   frame_id='8',
                  dest_addr_long='\x00\x13\xA2\x00\x41\x87\xB5\xD4',
                  command='D4')

xbee.remote_at(   frame_id='9',
                  dest_addr_long='\x00\x13\xA2\x00\x41\x87\xB5\xD4',
                  command='D6')

xbee.remote_at(   frame_id='A',
                  dest_addr_long='\x00\x13\xA2\x00\x41\x87\xB5\xD4',
                  command='D7')

xbee.remote_at(   frame_id='B',
                  dest_addr_long='\x00\x13\xA2\x00\x41\x87\xB5\xD4',
                  command='P1')



xbee.remote_at(   frame_id='F',
                  dest_addr_long='\x00\x13\xA2\x00\x41\x87\xB5\xD4',
                  command='IS')

# Show XBee responses?
while True:
    try:
        response = xbee.wait_read_frame()
        print response
    except KeyboardInterrupt:
        break

ser.close()

Produces this output

{'status': '\x00', 'source_addr': '\xff\xfe', 'source_addr_long': '\x00\x13\xa2\x00A\x87\xb5\xd4', 'frame_id': '1', 'command': 'P8', 'id': 'remote_at_response'}
{'status': '\x00', 'source_addr': '\xff\xfe', 'source_addr_long': '\x00\x13\xa2\x00A\x87\xb5\xd4', 'frame_id': '2', 'command': 'P8', 'id': 'remote_at_response'}
{'status': '\x00', 'source_addr': '\xff\xfe', 'source_addr_long': '\x00\x13\xa2\x00A\x87\xb5\xd4', 'frame_id': '3', 'command': 'P8', 'id': 'remote_at_response'}
{'status': '\x00', 'source_addr': '\xff\xfe', 'source_addr_long': '\x00\x13\xa2\x00A\x87\xb5\xd4', 'frame_id': '4', 'command': 'D0', 'parameter': '\x02', 'id': 'remote_at_response'}
{'status': '\x00', 'source_addr': '\xff\xfe', 'source_addr_long': '\x00\x13\xa2\x00A\x87\xb5\xd4', 'frame_id': '5', 'command': 'D1', 'parameter': '\x02', 'id': 'remote_at_response'}
{'status': '\x00', 'source_addr': '\xff\xfe', 'source_addr_long': '\x00\x13\xa2\x00A\x87\xb5\xd4', 'frame_id': '6', 'command': 'D2', 'parameter': '\x02', 'id': 'remote_at_response'}
{'status': '\x00', 'source_addr': '\xff\xfe', 'source_addr_long': '\x00\x13\xa2\x00A\x87\xb5\xd4', 'frame_id': '7', 'command': 'D3', 'parameter': '\x02', 'id': 'remote_at_response'}
{'status': '\x00', 'source_addr': '\xff\xfe', 'source_addr_long': '\x00\x13\xa2\x00A\x87\xb5\xd4', 'frame_id': '8', 'command': 'D4', 'parameter': '\x03', 'id': 'remote_at_response'}
{'status': '\x00', 'source_addr': '\xff\xfe', 'source_addr_long': '\x00\x13\xa2\x00A\x87\xb5\xd4', 'frame_id': '9', 'command': 'D6', 'parameter': '\x03', 'id': 'remote_at_response'}
{'status': '\x00', 'source_addr': '\xff\xfe', 'source_addr_long': '\x00\x13\xa2\x00A\x87\xb5\xd4', 'frame_id': 'A', 'command': 'D7', 'parameter': '\x03', 'id': 'remote_at_response'}
{'status': '\x00', 'source_addr': '\xff\xfe', 'source_addr_long': '\x00\x13\xa2\x00A\x87\xb5\xd4', 'frame_id': 'B', 'command': 'P1', 'parameter': '\x03', 'id': 'remote_at_response'}
{'status': '\x00', 'source_addr': '\xff\xfe', 'source_addr_long': '\x00\x13\xa2\x00A\x87\xb5\xd4', 'frame_id': 'F', 'command': 'IS', 'parameter': [{'adc-6': 10241, 'adc-2': 32769, 'dio-6': False, 'dio-7': False, 'dio-4': False}], 'id': 'remote_at_response'}

The parsed response from IS makes no sense to me, there should be 4x Dig ins (4,6,7 &11) and 4x Analogs, (AD0-3),

{'adc-6': 10241, 'adc-2': 32769, 'dio-6': False, 'dio-7': False, 'dio-4': False}

What's gone wrong here with the lib decoding (or am I just being very fat fingered with my code?)

Thanks

Andrew.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions