jblance/mpp-solar

JK BMS BLE Not Working - AttributeError: 'str' object has no attribute 'get_data_value'

luckylinux opened this issue · 6 comments

I have 2 x JK BMS that I just set up. One is HW v10 the other HW v11.

BMS Model should be B2A24S20P.

I tried to connect using BLE to both, but all I get is errors.

Tried both JK02 and JK04 as protocol, both fail.

Any idea what is going on ?

This is a 16s setup by the way (each BMS manages 16 cells).

(mppsolar) root@SolarMonitor:~# jkbms -p C8:47:8C:E5:98:96 -P JK02 -c getCellData
Command: getCellData - BLE Cell Data inquiry
--------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/venv/mppsolar/bin/jkbms", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/__init__.py", line 434, in main
    op.output(
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/outputs/screen.py", line 81, in output
    maxP = get_max_response_length(displayData)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/helpers.py", line 100, in get_max_response_length
    if len(response.get_data_value()) > _max_length:
           ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'get_data_value'
(mppsolar) root@SolarMonitor:~# jkbms -p C8:47:8C:E5:98:96 -P JK04 -c getCellData
Command: getCellData - BLE Cell Data inquiry
--------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/venv/mppsolar/bin/jkbms", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/__init__.py", line 434, in main
    op.output(
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/outputs/screen.py", line 81, in output
    maxP = get_max_response_length(displayData)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/helpers.py", line 100, in get_max_response_length
    if len(response.get_data_value()) > _max_length:
           ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'get_data_value'
(mppsolar) root@SolarMonitor:~# jkbms -p C8:47:8C:EC:1E:60 -P JK04 -c getCellData
Command: getCellData - BLE Cell Data inquiry
--------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/venv/mppsolar/bin/jkbms", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/__init__.py", line 434, in main
    op.output(
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/outputs/screen.py", line 81, in output
    maxP = get_max_response_length(displayData)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/helpers.py", line 100, in get_max_response_length
    if len(response.get_data_value()) > _max_length:
           ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'get_data_value'
(mppsolar) root@SolarMonitor:~# jkbms -p C8:47:8C:EC:1E:60 -P JK02 -c getCellData
Command: getCellData - BLE Cell Data inquiry
--------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/venv/mppsolar/bin/jkbms", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/__init__.py", line 434, in main
    op.output(
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/outputs/screen.py", line 81, in output
    maxP = get_max_response_length(displayData)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/helpers.py", line 100, in get_max_response_length
    if len(response.get_data_value()) > _max_length:
           ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'get_data_value'
(mppsolar) root@SolarMonitor:~# jkbms -p C8:47:8C:EC:1E:60 -P JK10 -c getCellData
2023-10-23 04:40:44,481:ERROR:__init__:get_protocol@21: No module found for protocol jk10
2023-10-23 04:40:44,482:ERROR:device:run_command@54: Attempted to run command with no protocol defined
Command: Unknown command - No description found
--------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/venv/mppsolar/bin/jkbms", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/__init__.py", line 434, in main
    op.output(
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/outputs/screen.py", line 81, in output
    maxP = get_max_response_length(displayData)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/helpers.py", line 100, in get_max_response_length
    if len(response.get_data_value()) > _max_length:
           ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'get_data_value'
(mppsolar) root@SolarMonitor:~# jkbms -p C8:47:8C:EC:1E:60 -P JK11 -c getCellData
2023-10-23 04:40:49,232:ERROR:__init__:get_protocol@21: No module found for protocol jk11
2023-10-23 04:40:49,233:ERROR:device:run_command@54: Attempted to run command with no protocol defined
Command: Unknown command - No description found
--------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/venv/mppsolar/bin/jkbms", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/__init__.py", line 434, in main
    op.output(
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/outputs/screen.py", line 81, in output
    maxP = get_max_response_length(displayData)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/helpers.py", line 100, in get_max_response_length
    if len(response.get_data_value()) > _max_length:
           ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'get_data_value'
``

Is this issue due to a too-recent version of Python ? I have Python 3.11.2 installed on Raspberry Pi 3B (32 bit).

Alright ... I tried to follow the Troubleshooting guide.

(mppsolar) root@SolarMonitor:~# hcitool -i hci1 lescan
LE Scan ...
C8:47:8C:E5:98:96 (unknown)
C8:47:8C:E5:98:96 BAT02
C8:47:8C:EC:1E:60 (unknown)
C8:47:8C:EC:1E:60 BAT01

Keep in mind that BAT01 is supposedly HW 11.x and BAT02 is supposedly HW 10.x.
JKv11 seems to be the protocol for HW 11.x, but what am I supposed to use with HW 10.x ? JK04 ? In the wiki JK04 seems to be for (much) older hardware versions.

Is there a way to specify which Interface to use with the jkbms command ? I have 2 USB BLE adapters that will provide much better reception compared to the built-in bluetooth antenna of the Raspberry PI, which is sitting in a Metal Case. So Antenna transmit/reception will be greatly reduced if jkbms is using the internal BLE by default. I guess I could blacklist the driver for the Linux kernel if all else fails ...

BAT01 HW 11.x with -P JKv11:

(mppsolar) root@SolarMonitor:~# mpp-solar -p C8:47:8C:EC:1E:60 -P JKv11 -D
2023-10-24 05:34:49,375:INFO:__init__:main@216: Solar Device Command Utility, version: 0.16.12-dev, python version: 3.11.2
2023-10-24 05:34:49,375:DEBUG:mqttbrokerc:__init__@29: mqttbroker config: {'name': 'localhost', 'port': 1883, 'user': None, 'pass': None}
2023-10-24 05:34:49,376:DEBUG:__init__:main@251: MqttBroker name: localhost, port: 1883, user: None
2023-10-24 05:34:49,376:DEBUG:__init__:main@253: udp port 5555
2023-10-24 05:34:49,376:DEBUG:__init__:main@255: Using Postgres None
2023-10-24 05:34:49,377:DEBUG:__init__:main@258: Using Mongo None with mppsolar
2023-10-24 05:34:49,377:INFO:__init__:main@359: Creating device "unnamed" (type: "mppsolar") on port "C8:47:8C:EC:1E:60 (porttype=None)" using protocol "JKv11"
2023-10-24 05:34:49,383:DEBUG:__init__:main@363: device_class <class 'mppsolar.devices.mppsolar.mppsolar'>
2023-10-24 05:34:49,383:DEBUG:device:__init__@34: __init__ args ()
2023-10-24 05:34:49,383:DEBUG:device:__init__@35: __init__ kwargs {'name': 'unnamed', 'port': 'C8:47:8C:EC:1E:60', 'protocol': 'JKv11', 'baud': 2400, 'porttype': None, 'mqtt_broker': <mppsolar.libs.mqttbrokerc.MqttBroker object at 0x755e4f50>, 'udp_port': '5555', 'mongo_url': None, 'mongo_db': 'mppsolar'}
2023-10-24 05:34:49,384:DEBUG:__init__:get_port_type@51: port matches jkble ':'
2023-10-24 05:34:49,384:INFO:__init__:get_port@105: Using jkbleio for communications
2023-10-24 05:34:49,432:DEBUG:__init__:get_protocol@13: Protocol JKv11
2023-10-24 05:34:49,442:DEBUG:device:__init__@39: __init__ name unnamed, port <mppsolar.inout.jkbleio.JkBleIO object at 0x756525b0>, protocol JKBMS BLE communication protocol handler software v11.x
2023-10-24 05:34:49,443:DEBUG:__init__:main@408: Commands [(<mppsolar.devices.mppsolar.mppsolar object at 0x767e4b90>, '', '', 'screen', None, None)]
2023-10-24 05:34:49,443:INFO:__init__:main@413: Looping 1 commands
2023-10-24 05:34:49,443:INFO:__init__:main@423: Getting results from device: mppsolar device - name: unnamed, port: <mppsolar.inout.jkbleio.JkBleIO object at 0x756525b0>, protocol: JKBMS BLE communication protocol handler software v11.x for command: , tag: , outputs: screen
2023-10-24 05:34:49,444:INFO:device:run_command@51: Running command 
2023-10-24 05:34:49,444:INFO:jkabstractprotocol:get_full_command@74: Using protocol b'JKv11' with 3 commands
2023-10-24 05:34:49,444:DEBUG:jkabstractprotocol:get_command_defn@105: get_command_defn for: getCellData
2023-10-24 05:34:49,444:DEBUG:abstractprotocol:get_command_defn@71: Processing command 'getCellData'
2023-10-24 05:34:49,444:DEBUG:abstractprotocol:get_command_defn@73: Found command getCellData in protocol b'JKv11'
2023-10-24 05:34:49,445:DEBUG:jkabstractprotocol:get_full_command@79: self._command = getCellData
2023-10-24 05:34:49,445:DEBUG:jkabstractprotocol:get_full_command@90: cmd with SOR: bytearray(b'\xaaU\x90\xeb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
2023-10-24 05:34:49,445:DEBUG:jkabstractprotocol:get_full_command@98: cmd with command code: bytearray(b'\xaaU\x90\xeb\x96\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
2023-10-24 05:34:49,445:DEBUG:jkabstractprotocol:get_full_command@100: cmd with crc: bytearray(b'\xaaU\x90\xeb\x96\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10')
2023-10-24 05:34:49,446:INFO:device:run_command@81: full command bytearray(b'\xaaU\x90\xeb\x96\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10') for command getCellData
2023-10-24 05:34:49,446:DEBUG:jkabstractprotocol:get_command_defn@105: get_command_defn for: getCellData
2023-10-24 05:34:49,446:DEBUG:abstractprotocol:get_command_defn@71: Processing command 'getCellData'
2023-10-24 05:34:49,446:DEBUG:abstractprotocol:get_command_defn@73: Found command getCellData in protocol b'JKv11'
2023-10-24 05:34:49,446:INFO:jkabstractprotocol:get_full_command@74: Using protocol b'JKv11' with 3 commands
2023-10-24 05:34:49,447:DEBUG:jkabstractprotocol:get_command_defn@105: get_command_defn for: getCellData
2023-10-24 05:34:49,447:DEBUG:abstractprotocol:get_command_defn@71: Processing command 'getCellData'
2023-10-24 05:34:49,447:DEBUG:abstractprotocol:get_command_defn@73: Found command getCellData in protocol b'JKv11'
2023-10-24 05:34:49,447:DEBUG:jkabstractprotocol:get_full_command@79: self._command = getCellData
2023-10-24 05:34:49,447:DEBUG:jkabstractprotocol:get_full_command@90: cmd with SOR: bytearray(b'\xaaU\x90\xeb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
2023-10-24 05:34:49,447:DEBUG:jkabstractprotocol:get_full_command@98: cmd with command code: bytearray(b'\xaaU\x90\xeb\x96\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
2023-10-24 05:34:49,448:DEBUG:jkabstractprotocol:get_full_command@100: cmd with crc: bytearray(b'\xaaU\x90\xeb\x96\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10')
2023-10-24 05:34:49,448:INFO:jkbleio:send_and_receive@29: full command bytearray(b'\xaaU\x90\xeb\x96\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10') for command getCellData
2023-10-24 05:34:49,448:DEBUG:jkabstractprotocol:get_command_defn@105: get_command_defn for: getCellData
2023-10-24 05:34:49,448:DEBUG:abstractprotocol:get_command_defn@71: Processing command 'getCellData'
2023-10-24 05:34:49,448:DEBUG:abstractprotocol:get_command_defn@73: Found command getCellData in protocol b'JKv11'
2023-10-24 05:34:49,448:DEBUG:jkbleio:send_and_receive@33: expected record type 2 for command getCellData
2023-10-24 05:34:49,449:INFO:jkbleio:ble_connect@57: Attempting to connect to C8:47:8C:EC:1E:60
2023-10-24 05:36:50,163:WARNING:jkbleio:ble_connect@61: Cannot connect to mac C8:47:8C:EC:1E:60 - exceeded 3 attempts
2023-10-24 05:36:50,164:ERROR:jkbleio:send_and_receive@40: Failed to connect to C8:47:8C:EC:1E:60
2023-10-24 05:36:50,164:DEBUG:jkbleio:send_and_receive@43: Raw response None
2023-10-24 05:36:50,165:DEBUG:device:run_command@98: Send and Receive Response None
2023-10-24 05:36:50,165:INFO:abstractprotocol:decode@246: response passed to decode: None
2023-10-24 05:36:50,165:DEBUG:jkabstractprotocol:get_command_defn@105: get_command_defn for: getCellData
2023-10-24 05:36:50,166:DEBUG:abstractprotocol:get_command_defn@71: Processing command 'getCellData'
2023-10-24 05:36:50,166:DEBUG:abstractprotocol:get_command_defn@73: Found command getCellData in protocol b'JKv11'
2023-10-24 05:36:50,167:INFO:abstractprotocol:decode@261: validity check fail: {'validity check': ['Error: Response was empty', '']}
2023-10-24 05:36:50,167:INFO:device:run_command@116: Decoded response {'_command': 'getCellData', '_command_description': 'BLE Cell Data inquiry', 'validity check': ['Error: Response was empty', '']}
2023-10-24 05:36:50,167:DEBUG:__init__:main@427: results: {'_command': 'getCellData', '_command_description': 'BLE Cell Data inquiry', 'validity check': ['Error: Response was empty', '']}
2023-10-24 05:36:50,168:INFO:__init__:get_output@40: attempting to create output processor: screen
2023-10-24 05:36:50,173:DEBUG:screen:__init__@15: processor.screen __init__ kwargs {}
2023-10-24 05:36:50,173:DEBUG:__init__:main@433: Using output filter: None
2023-10-24 05:36:50,174:INFO:screen:output@21: Using output processor: screen
2023-10-24 05:36:50,174:DEBUG:screen:output@22: kwargs {'data': {'_command': 'getCellData', '_command_description': 'BLE Cell Data inquiry', 'validity check': ['Error: Response was empty', '']}, 'tag': '', 'name': 'unnamed', 'mqtt_broker': <mppsolar.libs.mqttbrokerc.MqttBroker object at 0x755e4f50>, 'udp_port': '5555', 'postgres_url': None, 'mongo_url': None, 'mongo_db': 'mppsolar', 'mqtt_topic': None, 'filter': None, 'excl_filter': None, 'keep_case': False}
2023-10-24 05:36:50,175:DEBUG:screen:output@74: displayData: {'validity_check': ['Error: Response was empty', '']}
Command: getCellData - BLE Cell Data inquiry
--------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/venv/mppsolar/bin/mpp-solar", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/__init__.py", line 434, in main
    op.output(
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/outputs/screen.py", line 81, in output
    maxP = get_max_response_length(displayData)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/helpers.py", line 100, in get_max_response_length
    if len(response.get_data_value()) > _max_length:
           ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'get_data_value'

BAT02 HW 10.x with -P JK04:

(mppsolar) root@SolarMonitor:~# mpp-solar -p C8:47:8C:E5:98:96 -P JK04 -D
2023-10-24 05:32:15,424:INFO:__init__:main@216: Solar Device Command Utility, version: 0.16.12-dev, python version: 3.11.2
2023-10-24 05:32:15,425:DEBUG:mqttbrokerc:__init__@29: mqttbroker config: {'name': 'localhost', 'port': 1883, 'user': None, 'pass': None}
2023-10-24 05:32:15,426:DEBUG:__init__:main@251: MqttBroker name: localhost, port: 1883, user: None
2023-10-24 05:32:15,426:DEBUG:__init__:main@253: udp port 5555
2023-10-24 05:32:15,426:DEBUG:__init__:main@255: Using Postgres None
2023-10-24 05:32:15,426:DEBUG:__init__:main@258: Using Mongo None with mppsolar
2023-10-24 05:32:15,427:INFO:__init__:main@359: Creating device "unnamed" (type: "mppsolar") on port "C8:47:8C:E5:98:96 (porttype=None)" using protocol "JK04"
2023-10-24 05:32:15,433:DEBUG:__init__:main@363: device_class <class 'mppsolar.devices.mppsolar.mppsolar'>
2023-10-24 05:32:15,433:DEBUG:device:__init__@34: __init__ args ()
2023-10-24 05:32:15,433:DEBUG:device:__init__@35: __init__ kwargs {'name': 'unnamed', 'port': 'C8:47:8C:E5:98:96', 'protocol': 'JK04', 'baud': 2400, 'porttype': None, 'mqtt_broker': <mppsolar.libs.mqttbrokerc.MqttBroker object at 0x75cc4670>, 'udp_port': '5555', 'mongo_url': None, 'mongo_db': 'mppsolar'}
2023-10-24 05:32:15,434:DEBUG:__init__:get_port_type@51: port matches jkble ':'
2023-10-24 05:32:15,434:INFO:__init__:get_port@105: Using jkbleio for communications
2023-10-24 05:32:15,483:DEBUG:__init__:get_protocol@13: Protocol JK04
2023-10-24 05:32:15,493:DEBUG:device:__init__@39: __init__ name unnamed, port <mppsolar.inout.jkbleio.JkBleIO object at 0x755879d0>, protocol JK04 - JKBMS BLE 4 byte data communication protocol handler
2023-10-24 05:32:15,494:DEBUG:__init__:main@408: Commands [(<mppsolar.devices.mppsolar.mppsolar object at 0x76784b90>, '', '', 'screen', None, None)]
2023-10-24 05:32:15,494:INFO:__init__:main@413: Looping 1 commands
2023-10-24 05:32:15,494:INFO:__init__:main@423: Getting results from device: mppsolar device - name: unnamed, port: <mppsolar.inout.jkbleio.JkBleIO object at 0x755879d0>, protocol: JK04 - JKBMS BLE 4 byte data communication protocol handler for command: , tag: , outputs: screen
2023-10-24 05:32:15,494:INFO:device:run_command@51: Running command 
2023-10-24 05:32:15,495:INFO:jkabstractprotocol:get_full_command@74: Using protocol b'JK04' with 2 commands
2023-10-24 05:32:15,495:DEBUG:jkabstractprotocol:get_command_defn@105: get_command_defn for: getCellData
2023-10-24 05:32:15,495:DEBUG:abstractprotocol:get_command_defn@71: Processing command 'getCellData'
2023-10-24 05:32:15,495:DEBUG:abstractprotocol:get_command_defn@73: Found command getCellData in protocol b'JK04'
2023-10-24 05:32:15,496:DEBUG:jkabstractprotocol:get_full_command@79: self._command = getCellData
2023-10-24 05:32:15,496:DEBUG:jkabstractprotocol:get_full_command@90: cmd with SOR: bytearray(b'\xaaU\x90\xeb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
2023-10-24 05:32:15,496:DEBUG:jkabstractprotocol:get_full_command@98: cmd with command code: bytearray(b'\xaaU\x90\xeb\x96\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
2023-10-24 05:32:15,496:DEBUG:jkabstractprotocol:get_full_command@100: cmd with crc: bytearray(b'\xaaU\x90\xeb\x96\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10')
2023-10-24 05:32:15,497:INFO:device:run_command@81: full command bytearray(b'\xaaU\x90\xeb\x96\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10') for command getCellData
2023-10-24 05:32:15,497:DEBUG:jkabstractprotocol:get_command_defn@105: get_command_defn for: getCellData
2023-10-24 05:32:15,497:DEBUG:abstractprotocol:get_command_defn@71: Processing command 'getCellData'
2023-10-24 05:32:15,497:DEBUG:abstractprotocol:get_command_defn@73: Found command getCellData in protocol b'JK04'
2023-10-24 05:32:15,497:INFO:jkabstractprotocol:get_full_command@74: Using protocol b'JK04' with 2 commands
2023-10-24 05:32:15,498:DEBUG:jkabstractprotocol:get_command_defn@105: get_command_defn for: getCellData
2023-10-24 05:32:15,498:DEBUG:abstractprotocol:get_command_defn@71: Processing command 'getCellData'
2023-10-24 05:32:15,498:DEBUG:abstractprotocol:get_command_defn@73: Found command getCellData in protocol b'JK04'
2023-10-24 05:32:15,498:DEBUG:jkabstractprotocol:get_full_command@79: self._command = getCellData
2023-10-24 05:32:15,498:DEBUG:jkabstractprotocol:get_full_command@90: cmd with SOR: bytearray(b'\xaaU\x90\xeb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
2023-10-24 05:32:15,498:DEBUG:jkabstractprotocol:get_full_command@98: cmd with command code: bytearray(b'\xaaU\x90\xeb\x96\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
2023-10-24 05:32:15,499:DEBUG:jkabstractprotocol:get_full_command@100: cmd with crc: bytearray(b'\xaaU\x90\xeb\x96\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10')
2023-10-24 05:32:15,499:INFO:jkbleio:send_and_receive@29: full command bytearray(b'\xaaU\x90\xeb\x96\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10') for command getCellData
2023-10-24 05:32:15,499:DEBUG:jkabstractprotocol:get_command_defn@105: get_command_defn for: getCellData
2023-10-24 05:32:15,499:DEBUG:abstractprotocol:get_command_defn@71: Processing command 'getCellData'
2023-10-24 05:32:15,499:DEBUG:abstractprotocol:get_command_defn@73: Found command getCellData in protocol b'JK04'
2023-10-24 05:32:15,500:DEBUG:jkbleio:send_and_receive@33: expected record type 2 for command getCellData
2023-10-24 05:32:15,500:INFO:jkbleio:ble_connect@57: Attempting to connect to C8:47:8C:E5:98:96
2023-10-24 05:34:16,563:WARNING:jkbleio:ble_connect@61: Cannot connect to mac C8:47:8C:E5:98:96 - exceeded 3 attempts
2023-10-24 05:34:16,564:ERROR:jkbleio:send_and_receive@40: Failed to connect to C8:47:8C:E5:98:96
2023-10-24 05:34:16,564:DEBUG:jkbleio:send_and_receive@43: Raw response None
2023-10-24 05:34:16,565:DEBUG:device:run_command@98: Send and Receive Response None
2023-10-24 05:34:16,565:INFO:abstractprotocol:decode@246: response passed to decode: None
2023-10-24 05:34:16,566:DEBUG:jkabstractprotocol:get_command_defn@105: get_command_defn for: getCellData
2023-10-24 05:34:16,566:DEBUG:abstractprotocol:get_command_defn@71: Processing command 'getCellData'
2023-10-24 05:34:16,566:DEBUG:abstractprotocol:get_command_defn@73: Found command getCellData in protocol b'JK04'
2023-10-24 05:34:16,567:INFO:abstractprotocol:decode@261: validity check fail: {'validity check': ['Error: Response was empty', '']}
2023-10-24 05:34:16,567:INFO:device:run_command@116: Decoded response {'_command': 'getCellData', '_command_description': 'BLE Cell Data inquiry', 'validity check': ['Error: Response was empty', '']}
2023-10-24 05:34:16,568:DEBUG:__init__:main@427: results: {'_command': 'getCellData', '_command_description': 'BLE Cell Data inquiry', 'validity check': ['Error: Response was empty', '']}
2023-10-24 05:34:16,568:INFO:__init__:get_output@40: attempting to create output processor: screen
2023-10-24 05:34:16,573:DEBUG:screen:__init__@15: processor.screen __init__ kwargs {}
2023-10-24 05:34:16,574:DEBUG:__init__:main@433: Using output filter: None
2023-10-24 05:34:16,574:INFO:screen:output@21: Using output processor: screen
2023-10-24 05:34:16,575:DEBUG:screen:output@22: kwargs {'data': {'_command': 'getCellData', '_command_description': 'BLE Cell Data inquiry', 'validity check': ['Error: Response was empty', '']}, 'tag': '', 'name': 'unnamed', 'mqtt_broker': <mppsolar.libs.mqttbrokerc.MqttBroker object at 0x75cc4670>, 'udp_port': '5555', 'postgres_url': None, 'mongo_url': None, 'mongo_db': 'mppsolar', 'mqtt_topic': None, 'filter': None, 'excl_filter': None, 'keep_case': False}
2023-10-24 05:34:16,575:DEBUG:screen:output@74: displayData: {'validity_check': ['Error: Response was empty', '']}
Command: getCellData - BLE Cell Data inquiry
--------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/venv/mppsolar/bin/mpp-solar", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/__init__.py", line 434, in main
    op.output(
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/outputs/screen.py", line 81, in output
    maxP = get_max_response_length(displayData)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/helpers.py", line 100, in get_max_response_length
    if len(response.get_data_value()) > _max_length:
           ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'get_data_value'

BAT02 HW 10.x with -P JKv11:

(mppsolar) root@SolarMonitor:~# mpp-solar -p C8:47:8C:E5:98:96 -P JKv11 -D
2023-10-24 05:28:53,316:INFO:__init__:main@216: Solar Device Command Utility, version: 0.16.12-dev, python version: 3.11.2
2023-10-24 05:28:53,316:DEBUG:mqttbrokerc:__init__@29: mqttbroker config: {'name': 'localhost', 'port': 1883, 'user': None, 'pass': None}
2023-10-24 05:28:53,317:DEBUG:__init__:main@251: MqttBroker name: localhost, port: 1883, user: None
2023-10-24 05:28:53,317:DEBUG:__init__:main@253: udp port 5555
2023-10-24 05:28:53,318:DEBUG:__init__:main@255: Using Postgres None
2023-10-24 05:28:53,318:DEBUG:__init__:main@258: Using Mongo None with mppsolar
2023-10-24 05:28:53,318:INFO:__init__:main@359: Creating device "unnamed" (type: "mppsolar") on port "C8:47:8C:E5:98:96 (porttype=None)" using protocol "JKv11"
2023-10-24 05:28:53,327:DEBUG:__init__:main@363: device_class <class 'mppsolar.devices.mppsolar.mppsolar'>
2023-10-24 05:28:53,327:DEBUG:device:__init__@34: __init__ args ()
2023-10-24 05:28:53,327:DEBUG:device:__init__@35: __init__ kwargs {'name': 'unnamed', 'port': 'C8:47:8C:E5:98:96', 'protocol': 'JKv11', 'baud': 2400, 'porttype': None, 'mqtt_broker': <mppsolar.libs.mqttbrokerc.MqttBroker object at 0x755e4f50>, 'udp_port': '5555', 'mongo_url': None, 'mongo_db': 'mppsolar'}
2023-10-24 05:28:53,328:DEBUG:__init__:get_port_type@51: port matches jkble ':'
2023-10-24 05:28:53,328:INFO:__init__:get_port@105: Using jkbleio for communications
2023-10-24 05:28:53,377:DEBUG:__init__:get_protocol@13: Protocol JKv11
2023-10-24 05:28:53,387:DEBUG:device:__init__@39: __init__ name unnamed, port <mppsolar.inout.jkbleio.JkBleIO object at 0x756528f0>, protocol JKBMS BLE communication protocol handler software v11.x
2023-10-24 05:28:53,388:DEBUG:__init__:main@408: Commands [(<mppsolar.devices.mppsolar.mppsolar object at 0x767e4b90>, '', '', 'screen', None, None)]
2023-10-24 05:28:53,388:INFO:__init__:main@413: Looping 1 commands
2023-10-24 05:28:53,388:INFO:__init__:main@423: Getting results from device: mppsolar device - name: unnamed, port: <mppsolar.inout.jkbleio.JkBleIO object at 0x756528f0>, protocol: JKBMS BLE communication protocol handler software v11.x for command: , tag: , outputs: screen
2023-10-24 05:28:53,389:INFO:device:run_command@51: Running command 
2023-10-24 05:28:53,389:INFO:jkabstractprotocol:get_full_command@74: Using protocol b'JKv11' with 3 commands
2023-10-24 05:28:53,389:DEBUG:jkabstractprotocol:get_command_defn@105: get_command_defn for: getCellData
2023-10-24 05:28:53,389:DEBUG:abstractprotocol:get_command_defn@71: Processing command 'getCellData'
2023-10-24 05:28:53,389:DEBUG:abstractprotocol:get_command_defn@73: Found command getCellData in protocol b'JKv11'
2023-10-24 05:28:53,390:DEBUG:jkabstractprotocol:get_full_command@79: self._command = getCellData
2023-10-24 05:28:53,390:DEBUG:jkabstractprotocol:get_full_command@90: cmd with SOR: bytearray(b'\xaaU\x90\xeb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
2023-10-24 05:28:53,390:DEBUG:jkabstractprotocol:get_full_command@98: cmd with command code: bytearray(b'\xaaU\x90\xeb\x96\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
2023-10-24 05:28:53,390:DEBUG:jkabstractprotocol:get_full_command@100: cmd with crc: bytearray(b'\xaaU\x90\xeb\x96\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10')
2023-10-24 05:28:53,391:INFO:device:run_command@81: full command bytearray(b'\xaaU\x90\xeb\x96\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10') for command getCellData
2023-10-24 05:28:53,391:DEBUG:jkabstractprotocol:get_command_defn@105: get_command_defn for: getCellData
2023-10-24 05:28:53,391:DEBUG:abstractprotocol:get_command_defn@71: Processing command 'getCellData'
2023-10-24 05:28:53,391:DEBUG:abstractprotocol:get_command_defn@73: Found command getCellData in protocol b'JKv11'
2023-10-24 05:28:53,392:INFO:jkabstractprotocol:get_full_command@74: Using protocol b'JKv11' with 3 commands
2023-10-24 05:28:53,392:DEBUG:jkabstractprotocol:get_command_defn@105: get_command_defn for: getCellData
2023-10-24 05:28:53,392:DEBUG:abstractprotocol:get_command_defn@71: Processing command 'getCellData'
2023-10-24 05:28:53,392:DEBUG:abstractprotocol:get_command_defn@73: Found command getCellData in protocol b'JKv11'
2023-10-24 05:28:53,392:DEBUG:jkabstractprotocol:get_full_command@79: self._command = getCellData
2023-10-24 05:28:53,392:DEBUG:jkabstractprotocol:get_full_command@90: cmd with SOR: bytearray(b'\xaaU\x90\xeb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
2023-10-24 05:28:53,393:DEBUG:jkabstractprotocol:get_full_command@98: cmd with command code: bytearray(b'\xaaU\x90\xeb\x96\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
2023-10-24 05:28:53,393:DEBUG:jkabstractprotocol:get_full_command@100: cmd with crc: bytearray(b'\xaaU\x90\xeb\x96\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10')
2023-10-24 05:28:53,393:INFO:jkbleio:send_and_receive@29: full command bytearray(b'\xaaU\x90\xeb\x96\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10') for command getCellData
2023-10-24 05:28:53,393:DEBUG:jkabstractprotocol:get_command_defn@105: get_command_defn for: getCellData
2023-10-24 05:28:53,393:DEBUG:abstractprotocol:get_command_defn@71: Processing command 'getCellData'
2023-10-24 05:28:53,393:DEBUG:abstractprotocol:get_command_defn@73: Found command getCellData in protocol b'JKv11'
2023-10-24 05:28:53,394:DEBUG:jkbleio:send_and_receive@33: expected record type 2 for command getCellData
2023-10-24 05:28:53,394:INFO:jkbleio:ble_connect@57: Attempting to connect to C8:47:8C:E5:98:96
2023-10-24 05:30:54,323:WARNING:jkbleio:ble_connect@61: Cannot connect to mac C8:47:8C:E5:98:96 - exceeded 3 attempts
2023-10-24 05:30:54,324:ERROR:jkbleio:send_and_receive@40: Failed to connect to C8:47:8C:E5:98:96
2023-10-24 05:30:54,324:DEBUG:jkbleio:send_and_receive@43: Raw response None
2023-10-24 05:30:54,325:DEBUG:device:run_command@98: Send and Receive Response None
2023-10-24 05:30:54,325:INFO:abstractprotocol:decode@246: response passed to decode: None
2023-10-24 05:30:54,326:DEBUG:jkabstractprotocol:get_command_defn@105: get_command_defn for: getCellData
2023-10-24 05:30:54,326:DEBUG:abstractprotocol:get_command_defn@71: Processing command 'getCellData'
2023-10-24 05:30:54,326:DEBUG:abstractprotocol:get_command_defn@73: Found command getCellData in protocol b'JKv11'
2023-10-24 05:30:54,327:INFO:abstractprotocol:decode@261: validity check fail: {'validity check': ['Error: Response was empty', '']}
2023-10-24 05:30:54,327:INFO:device:run_command@116: Decoded response {'_command': 'getCellData', '_command_description': 'BLE Cell Data inquiry', 'validity check': ['Error: Response was empty', '']}
2023-10-24 05:30:54,328:DEBUG:__init__:main@427: results: {'_command': 'getCellData', '_command_description': 'BLE Cell Data inquiry', 'validity check': ['Error: Response was empty', '']}
2023-10-24 05:30:54,328:INFO:__init__:get_output@40: attempting to create output processor: screen
2023-10-24 05:30:54,333:DEBUG:screen:__init__@15: processor.screen __init__ kwargs {}
2023-10-24 05:30:54,334:DEBUG:__init__:main@433: Using output filter: None
2023-10-24 05:30:54,334:INFO:screen:output@21: Using output processor: screen
2023-10-24 05:30:54,335:DEBUG:screen:output@22: kwargs {'data': {'_command': 'getCellData', '_command_description': 'BLE Cell Data inquiry', 'validity check': ['Error: Response was empty', '']}, 'tag': '', 'name': 'unnamed', 'mqtt_broker': <mppsolar.libs.mqttbrokerc.MqttBroker object at 0x755e4f50>, 'udp_port': '5555', 'postgres_url': None, 'mongo_url': None, 'mongo_db': 'mppsolar', 'mqtt_topic': None, 'filter': None, 'excl_filter': None, 'keep_case': False}
2023-10-24 05:30:54,335:DEBUG:screen:output@74: displayData: {'validity_check': ['Error: Response was empty', '']}
Command: getCellData - BLE Cell Data inquiry
--------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/venv/mppsolar/bin/mpp-solar", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/__init__.py", line 434, in main
    op.output(
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/outputs/screen.py", line 81, in output
    maxP = get_max_response_length(displayData)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/helpers.py", line 100, in get_max_response_length
    if len(response.get_data_value()) > _max_length:
           ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'get_data_value'

Looking at these Debug information it seems to be a BLE communication issue:

2023-10-24 05:36:50,163:WARNING:jkbleio:ble_connect@61: Cannot connect to mac C8:47:8C:EC:1E:60 - exceeded 3 attempts

2023-10-24 05:34:16,563:WARNING:jkbleio:ble_connect@61: Cannot connect to mac C8:47:8C:E5:98:96 - exceeded 3 attempts

2023-10-24 05:30:54,323:WARNING:jkbleio:ble_connect@61: Cannot connect to mac C8:47:8C:E5:98:96 - exceeded 3 attempts

Now I disabled onboard bluetooth of Raspberry Pi3 and I am getting somewhere ...

Add to /boot/config.txt

# Disable Bluetooth
dtoverlay=disable-bt

Attached are the DEBUG logs for:

  • BAT01 HW 11.x with -P JKv11
  • BAT02 HW 10.x with -P JK04
  • BAT02 HW 10.x with -P JKv11

BAT02_HW10_JKv11_Communication_Working.txt
BAT02_HW10_JK04_Communication_Working.txt
BAT01_HW11_JKv11_Communication_Working.txt

But even if I can manage to get the Data out (Debug logs show Cell Voltages etc), the "normal" command still fails with the same error. There seems to be a problem in the Data Postprocessing ?

(mppsolar) root@SolarMonitor:~# jkbms -p C8:47:8C:EC:1E:60 -P jkv11 -c getInfo
Command: getInfo - BLE Device Information inquiry
--------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/venv/mppsolar/bin/jkbms", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/__init__.py", line 434, in main
    op.output(
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/outputs/screen.py", line 81, in output
    maxP = get_max_response_length(displayData)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/helpers.py", line 100, in get_max_response_length
    if len(response.get_data_value()) > _max_length:
           ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'get_data_value'
(mppsolar) root@SolarMonitor:~# jkbms -p C8:47:8C:EC:1E:60 -P jkv11 -c getCellData
Command: getCellData - BLE Cell Data inquiry
--------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/venv/mppsolar/bin/jkbms", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/__init__.py", line 434, in main
    op.output(
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/outputs/screen.py", line 81, in output
    maxP = get_max_response_length(displayData)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/helpers.py", line 100, in get_max_response_length
    if len(response.get_data_value()) > _max_length:
           ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'get_data_value'

And

(mppsolar) root@SolarMonitor:~# jkbms -p C8:47:8C:E5:98:96 -P jkv11 -c getCellData
Command: getCellData - BLE Cell Data inquiry
--------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/venv/mppsolar/bin/jkbms", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/__init__.py", line 434, in main
    op.output(
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/outputs/screen.py", line 81, in output
    maxP = get_max_response_length(displayData)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/helpers.py", line 100, in get_max_response_length
    if len(response.get_data_value()) > _max_length:
           ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'get_data_value'

And

(mppsolar) root@SolarMonitor:~# jkbms -p C8:47:8C:E5:98:96 -P jk04 -c getCellData
Command: getCellData - BLE Cell Data inquiry
--------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/venv/mppsolar/bin/jkbms", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/__init__.py", line 434, in main
    op.output(
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/outputs/screen.py", line 81, in output
    maxP = get_max_response_length(displayData)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/mppsolar/src/mppsolar/mppsolar/helpers.py", line 100, in get_max_response_length
    if len(response.get_data_value()) > _max_length:
           ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'get_data_value'

Any update on this ?

this bug should have been fixed in version 0.16.13