Hi,
I'm trying to use this library with a FlexMax 60 charge controller.
Unfortunately I seem to be stuck on an infinite "Invalid checksum" error cycle which I assume might be related to #22
This is the code that I'm currently running
from pymate.matenet import MateNET, MateDevice, MateMXDevice, MateFXDevice, MateDCDevice
import logging
log = logging.getLogger('mate')
log.setLevel(logging.DEBUG)
log.addHandler(logging.StreamHandler())
mate_bus = MateNET('/dev/ttyUSB0') # Linux
mate_mx = MateMXDevice(mate_bus, port=0) # 0: No hub. 1-9: Hub port
mate_mx.scan() # This will raise an exception if the device isn't found
status = mate_mx.get_status()
print(status)
And this is the output I'm getting
Send [Port0, Type=0x02, Addr=0x0000, Param=0x0000]
TX: [1] 00
TX: [0] 02 00 00 00 00 00 02
RX: 02 00 60 f0
RETRY
TX: [1] 00
TX: [0] 02 00 00 00 00 00 02
RX: 02 00 03 00 f0
RETRY
TX: [1] 00
TX: [0] 02 00 00 00 00 00 02
RX: 02 00 60 f0
Traceback (most recent call last):
File "test.py", line 11, in <module>
mate_mx.scan() # This will raise an exception if the device isn't found
File "pymate/matenet/mx.py", line 154, in scan
devid = super(MateMXDevice, self).scan()
File "pymate/matenet/matedevice.py", line 38, in scan
return self.matenet.scan(self.port)
File "pymate/matenet/matenet.py", line 169, in scan
result = self.query(0x00, port=port)
File "pymate/matenet/matenet.py", line 134, in query
resp = self.send(MateNET.TYPE_QUERY, addr=reg, param=param, port=port)
File "pymate/matenet/matenet.py", line 87, in send
rxbuf = self.port.recv()
File "pymate/matenet/matenet_ser.py", line 159, in recv
return MateNETSerial._parse_packet(rawdata)
File "pymate/matenet/matenet_ser.py", line 118, in _parse_packet
% (expected_chksum, actual_chksum))
RuntimeError: Error receiving mate packet - Invalid checksum (Expected:60f0, Actual:0002)
As you can see in the second attempt, I get the response 02 00 03 00 f0 which to me looks to be what I'd expect (from reading the protocol spec), 02 indicating a read command response, 00 03 indicating an MX unit and 00 f0 as the checksum, even tho it seems to be invalid as I'd expect it to be 00 05 from what I can see from the docs, but neither the checksum from the unit nor the expected checksum seem to be valid.
I would appreciate any help on this.
Thanks
Hi,
I'm trying to use this library with a FlexMax 60 charge controller.
Unfortunately I seem to be stuck on an infinite "Invalid checksum" error cycle which I assume might be related to #22
This is the code that I'm currently running
And this is the output I'm getting
As you can see in the second attempt, I get the response
02 00 03 00 f0which to me looks to be what I'd expect (from reading the protocol spec),02indicating a read command response,00 03indicating an MX unit and00 f0as the checksum, even tho it seems to be invalid as I'd expect it to be00 05from what I can see from the docs, but neither the checksum from the unit nor the expected checksum seem to be valid.I would appreciate any help on this.
Thanks