Skip to content

readout.py: KeyError: 'MX device not found' #23

@two9ers

Description

@two9ers

I'm getting the following error when running readout.py
Apologies for formatting issues, having a bit of trouble with that also...

MATE emulator (MX)
Traceback (most recent call last)
File "readout.py", line 13, in
port = bus.find_device(MateNET.DEVICE_MX)
File "/home/pi/pymate-master/pymate/matenet/matenet.py", line 213, in find_device
raise KeyError('%s device not found' % MateNET.DEVICE_TYPES[device_type])
KeyError: 'MX device not found'

I added some print commands and set port 4:

bus = MateNET(SERIAL_PORT)
print "bus", bus

#port = bus.find_device(MateNET.DEVICE_MX)
port = 4
print "port", port

mate = MateMXDevice(bus, port)
print "mate", mate

mate.scan()

print "Revision:", mate.revision

New error shows up:

MATE emulator (MX)
bus <pymate.matenet.matenet.MateNET object at 0xb669e470>
port 4
mate <pymate.matenet.mx.MateMXDevice object at 0xb669e830>
Revision: 44451.173.000
Getting log page... (day:-1)
MX Log Page:
Day: -0
0Ah 361.6kWh
1Vpk 0.1Apk 0.000kWpk
Min: 0.0V Max: 1.5V
Absorb: 0min Float: 0min

Status:
Traceback (most recent call last):
File "readout.py", line 34, in
status = mate.get_status()
File "/home/pi/pymate-master/pymate/matenet/mx.py", line 167, in get_status
return MXStatusPacket.from_buffer(resp)
File "/home/pi/pymate-master/pymate/matenet/mx.py", line 50, in from_buffer
values = cls.fmt.unpack(data)
struct.error: unpack requires a string argument of length 13

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions