jblance / mpp-solar

Python package to communicate to MPP Solar PIP-4048MS inverters (and similar)
MIT License
364 stars 151 forks source link

Getting protocol_id 0 #294

Closed NosIreland closed 1 year ago

NosIreland commented 1 year ago

Hi, I am trying to run mpp-solar on ubuntu 20.04 host with USB cable that came with inverter. The cable works fine with windows software provided. I'm running mpp-solar in venv and when I do QPI I get this:

(mppsolar) root@hp-mini:~# mpp-solar -p /dev/hidraw0 -c QPI -I -D
2023-01-04 16:04:56,576:INFO:__init__:main@218: Solar Device Command Utility, version: 0.14.12
2023-01-04 16:04:56,576:DEBUG:__init__:main@238: MqttBroker(name='localhost', port=1883, username=None, password=None, results_topic='mpp-solar', mqttc=<paho.mqtt.client.Client object at 0x7f37a5fb2dc0>, _isConnected=False)
2023-01-04 16:04:56,576:DEBUG:__init__:main@240: udp port 5555
2023-01-04 16:04:56,576:DEBUG:__init__:main@242: Using Postgres None
2023-01-04 16:04:56,577:DEBUG:__init__:main@245: Using Mongo None with mppsolar
2023-01-04 16:04:56,577:INFO:__init__:main@347: Creating device "unnamed" (type: "mppsolar") on port "/dev/hidraw0 (porttype=None)" using protocol "PI30"
2023-01-04 16:04:56,578:DEBUG:__init__:main@351: device_class <class 'mppsolar.devices.mppsolar.mppsolar'>
2023-01-04 16:04:56,578:DEBUG:device:__init__@33: __init__ args ()
2023-01-04 16:04:56,578:DEBUG:device:__init__@34: __init__ kwargs {'name': 'unnamed', 'port': '/dev/hidraw0', 'protocol': 'PI30', 'baud': 2400, 'porttype': None, 'mqtt_broker': MqttBroker(name='localhost', port=1883, username=None, password=None, results_topic='mpp-solar', mqttc=<paho.mqtt.client.Client object at 0x7f37a5fb2dc0>, _isConnected=False), 'udp_port': '5555', 'mongo_url': None, 'mongo_db': 'mppsolar'}
2023-01-04 16:04:56,578:DEBUG:__init__:get_port_type@39: port matches hidraw
2023-01-04 16:04:56,578:INFO:__init__:get_port@92: Using hidrawio for communications
2023-01-04 16:04:56,579:DEBUG:__init__:get_protocol@13: Protocol PI30
2023-01-04 16:04:56,580:DEBUG:device:__init__@38: __init__ name unnamed, port <mppsolar.inout.hidrawio.HIDRawIO object at 0x7f37a5838eb0>, protocol PI30 protocol handler
2023-01-04 16:04:56,581:DEBUG:__init__:main@399: Commands [(<mppsolar.devices.mppsolar.mppsolar object at 0x7f37a5838f40>, 'QPI', 'QPI', 'screen', None, None)]
2023-01-04 16:04:56,581:INFO:__init__:main@404: Looping 1 commands
2023-01-04 16:04:56,581:INFO:__init__:main@414: Getting results from device: mppsolar device - name: unnamed, port: <mppsolar.inout.hidrawio.HIDRawIO object at 0x7f37a5838eb0>, protocol: PI30 protocol handler for command: QPI, tag: QPI, outputs: screen
2023-01-04 16:04:56,581:INFO:device:run_command@274: Running command QPI
2023-01-04 16:04:56,581:INFO:abstractprotocol:get_full_command@55: Using protocol b'PI30' with 40 commands
2023-01-04 16:04:56,581:DEBUG:protocol_helpers:crcPI@313: Calculating CRC for b'QPI'
2023-01-04 16:04:56,581:DEBUG:protocol_helpers:crcPI@363: Generated CRC 0xbe 0xac 0xbeac
2023-01-04 16:04:56,581:DEBUG:abstractprotocol:get_full_command@63: full command: b'QPI\xbe\xac\r'
2023-01-04 16:04:56,581:INFO:device:run_command@303: full command b'QPI\xbe\xac\r' for command QPI
2023-01-04 16:04:56,581:DEBUG:abstractprotocol:get_command_defn@67: Processing command 'QPI'
2023-01-04 16:04:56,581:DEBUG:abstractprotocol:get_command_defn@69: Found command QPI in protocol b'PI30'
2023-01-04 16:04:56,640:DEBUG:hidrawio:send_and_receive@29: length of to_send: 6
2023-01-04 16:04:56,640:DEBUG:hidrawio:send_and_receive@36: 1 chunk send
2023-01-04 16:04:57,394:DEBUG:hidrawio:send_and_receive@69: usb response was: b'^0\x1b\xe3\r'
2023-01-04 16:04:57,395:DEBUG:device:run_command@322: Send and Receive Response b'^0\x1b\xe3\r'
2023-01-04 16:04:57,395:INFO:abstractprotocol:decode@208: response passed to decode: b'^0\x1b\xe3\r'
2023-01-04 16:04:57,395:DEBUG:protocol_helpers:crcPI@313: Calculating CRC for b'^0'
2023-01-04 16:04:57,395:DEBUG:protocol_helpers:crcPI@363: Generated CRC 0x1b 0xe3 0x1be3
2023-01-04 16:04:57,395:DEBUG:pi30:check_response_valid@914: CRCs match
2023-01-04 16:04:57,395:DEBUG:abstractprotocol:get_command_defn@67: Processing command 'QPI'
2023-01-04 16:04:57,396:DEBUG:abstractprotocol:get_command_defn@69: Found command QPI in protocol b'PI30'
2023-01-04 16:04:57,396:INFO:abstractprotocol:decode@250: Processing response of type DEFAULT
2023-01-04 16:04:57,396:DEBUG:abstractprotocol:decode@254: trimmed and split responses: [b'0']
2023-01-04 16:04:57,396:INFO:abstractprotocol:decode@261: Processing DEFAULT type responses
2023-01-04 16:04:57,396:INFO:device:run_command@341: Decoded response {'raw_response': ['^0\x1bã\r', ''], '_command': 'QPI', '_command_description': 'Protocol ID inquiry', 'Protocol ID': ['0', '']}
2023-01-04 16:04:57,396:DEBUG:__init__:main@418: results: {'raw_response': ['^0\x1bã\r', ''], '_command': 'QPI', '_command_description': 'Protocol ID inquiry', 'Protocol ID': ['0', '']}
2023-01-04 16:04:57,396:INFO:__init__:get_output@38: attempting to create output processor: screen
2023-01-04 16:04:57,398:DEBUG:screen:__init__@16: processor.screen __init__ kwargs {}
2023-01-04 16:04:57,398:DEBUG:__init__:main@424: Using output filter: None
2023-01-04 16:04:57,399:INFO:screen:output@19: Using output processor: screen
2023-01-04 16:04:57,399:DEBUG:screen:output@20: kwargs {'data': {'raw_response': ['^0\x1bã\r', ''], '_command': 'QPI', '_command_description': 'Protocol ID inquiry', 'Protocol ID': ['0', '']}, 'tag': 'QPI', 'name': 'unnamed', 'mqtt_broker': MqttBroker(name='localhost', port=1883, username=None, password=None, results_topic='mpp-solar', mqttc=<paho.mqtt.client.Client object at 0x7f37a5fb2dc0>, _isConnected=False), 'udp_port': '5555', 'postgres_url': None, 'mongo_url': None, 'mongo_db': 'mppsolar', 'filter': None, 'excl_filter': None, 'keep_case': False}
Command: QPI - Protocol ID inquiry
------------------------------------------------------------
Parameter                       Value           Unit
protocol_id                     0

Edit: Inverter model is MPI 4KW

jblance commented 1 year ago

Try protocol pi17 and command PI

NosIreland commented 1 year ago

Try protocol pi17 and command PI

Thank you, got it running with PI17