jblance / mpp-solar

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

pip install mppsolar[ble] Freeze Raspberry PI Zero W2 #476

Closed fableman73 closed 6 months ago

fableman73 commented 8 months ago

I cant install, the Raspberry Pi Zero W21 freeze up during install..

Dont know why. Noticed that CCL took 100% CPU for a long time now and then during the install.

All I need is just get CLI data from the JKBMS data over BLE, nothing else... Is the install too big ? Any hints ?

I am stuck.,,, tried it a few times and always same problem,,, everything working, new SSD card...

`root@husb:~# pip install mppsolar[ble] Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Collecting mppsolar[ble] Using cached https://www.piwheels.org/simple/mppsolar/mppsolar-0.15.62-py3-none-any.whl (122 kB) Collecting pydantic<2.0.0,>=1.10.7 Using cached pydantic-1.10.14-py3-none-any.whl (158 kB) Collecting PyYAML>=6 Using cached PyYAML-6.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (731 kB) Collecting paho-mqtt>=1.6 Using cached https://www.piwheels.org/simple/paho-mqtt/paho_mqtt-2.0.0-py3-none-any.whl (66 kB) Collecting strenum<0.5.0,>=0.4.10 Using cached https://www.piwheels.org/simple/strenum/StrEnum-0.4.15-py3-none-any.whl (8.9 kB) Collecting pyserial>3 Using cached https://www.piwheels.org/simple/pyserial/pyserial-3.5-py2.py3-none-any.whl (90 kB) Collecting bleak<0.21.0,>=0.20.2 Using cached https://www.piwheels.org/simple/bleak/bleak-0.20.2-py3-none-any.whl (135 kB) Requirement already satisfied: bluepy<2.0.0,>=1.3.0 in /usr/local/lib/python3.9/dist-packages (from mppsolar[ble]) (1.3.0) Collecting async-timeout<5,>=3.0.0 Using cached https://www.piwheels.org/simple/async-timeout/async_timeout-4.0.3-py3-none-any.whl (5.7 kB) Collecting dbus-fast<2.0.0,>=1.83.0 Using cached dbus_fast-1.95.2.tar.gz (67 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing wheel metadata ... done Collecting typing-extensions>=4.2.0 Using cached https://www.piwheels.org/simple/typing-extensions/typing_extensions-4.10.0-py3-none-any.whl (33 kB) Building wheels for collected packages: dbus-fast Building wheel for dbus-fast (PEP 517) ... \


top - 16:27:21 up 17 min, 2 users, load average: 7.62, 3.89, 1.93 Tasks: 147 total, 1 running, 146 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.2 us, 13.6 sy, 0.0 ni, 16.5 id, 69.6 wa, 0.0 hi, 0.1 si, 0.0 st MiB Mem : 419.3 total, 83.1 free, 314.2 used, 22.0 buff/cache MiB Swap: 100.0 total, 0.1 free, 99.9 used. 70.0 avail Mem

PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
 54 root      20   0       0      0      0 S 100.0   0.0   1:16.89 kswapd0
682 root      20   0  137952 103088      0 D  18.3  24.0   1:06.85 cc1
632 fableman  20   0    9844   1080    624 R  10.3   0.3   0:11.82 top
 95 root       0 -20       0      0      0 I   7.1   0.0   0:06.61 kworker+
343 avahi     20   0    7064    836    560 S   7.0   0.2   0:02.75 avahi-d+
550 root      20   0   73576    248      0 S   5.7   0.1   0:02.03 nmbd
 97 root       0 -20       0      0      0 I   4.8   0.0   0:07.31 kworker+

`

Saentist commented 8 months ago

Cross-compile it on some potential system or be patient to finish.

fableman73 commented 8 months ago

--- Cross-compile it on some potential system what files do I need to transfer ?

--- or be patient to finish. The system hangs and is unresponsive after 30 minutes.

Saentist commented 8 months ago

CC1 is compilator embedded system are slowwwwwer for non dedicated jobs.

fableman73 commented 8 months ago

After 5 hours waiting I gave up,, the RPi Zero W2 can't install..

Then I did this:


export SKIP_CYTHON=false
pip install mppsolar[ble]

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting mppsolar[ble]
  Downloading https://www.piwheels.org/simple/mppsolar/mppsolar-0.15.62-py3-none-any.whl (122 kB)
     |████████████████████████████████| 122 kB 770 kB/s
Collecting PyYAML>=6
  Downloading PyYAML-6.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (731 kB)
     |████████████████████████████████| 731 kB 2.0 MB/s
Collecting pyserial>3
  Downloading https://www.piwheels.org/simple/pyserial/pyserial-3.5-py2.py3-none-any.whl (90 kB)
     |████████████████████████████████| 90 kB 850 kB/s
Collecting paho-mqtt>=1.6
  Downloading https://www.piwheels.org/simple/paho-mqtt/paho_mqtt-2.0.0-py3-none-any.whl (66 kB)
     |████████████████████████████████| 66 kB 1.4 MB/s
Collecting pydantic<2.0.0,>=1.10.7
  Downloading pydantic-1.10.14-py3-none-any.whl (158 kB)
     |████████████████████████████████| 158 kB 2.4 MB/s
Collecting strenum<0.5.0,>=0.4.10
  Downloading https://www.piwheels.org/simple/strenum/StrEnum-0.4.15-py3-none-any.whl (8.9 kB)
Collecting bluepy<2.0.0,>=1.3.0
  Downloading bluepy-1.3.0.tar.gz (217 kB)
     |████████████████████████████████| 217 kB 2.3 MB/s
Collecting bleak<0.21.0,>=0.20.2
  Downloading https://www.piwheels.org/simple/bleak/bleak-0.20.2-py3-none-any.whl (135 kB)
     |████████████████████████████████| 135 kB 955 kB/s
Collecting async-timeout<5,>=3.0.0
  Downloading https://www.piwheels.org/simple/async-timeout/async_timeout-4.0.3-py3-none-any.whl (5.7 kB)
Collecting dbus-fast<2.0.0,>=1.83.0
  Downloading dbus_fast-1.95.2.tar.gz (67 kB)
     |████████████████████████████████| 67 kB 1.0 MB/s
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Collecting typing-extensions>=4.2.0
  Downloading https://www.piwheels.org/simple/typing-extensions/typing_extensions-4.10.0-py3-none-any.whl (33 kB)
Building wheels for collected packages: bluepy, dbus-fast
  Building wheel for bluepy (setup.py) ... done
  Created wheel for bluepy: filename=bluepy-1.3.0-cp39-cp39-linux_aarch64.whl size=557056 sha256=d6772e49a0a0f8cab9c2dee27aa8bf584760228793f433013c2eeab70b611e58
  Stored in directory: /root/.cache/pip/wheels/69/19/c8/ce29283853bd5d7d0041d0afb023c22e2b880b4194f73230b1
  Building wheel for dbus-fast (PEP 517) ... done
  Created wheel for dbus-fast: filename=dbus_fast-1.95.2-cp39-cp39-manylinux_2_31_aarch64.whl size=75594 sha256=8da66734e8dfbc335c1c035cd2aa6f4033e343c04fb8a7e6948029537bb9258a
  Stored in directory: /root/.cache/pip/wheels/57/57/dd/8cf1530c02f62c1e5bfe71fd2fe9bbfde2f2ecd610466de148
Successfully built bluepy dbus-fast
Installing collected packages: typing-extensions, strenum, PyYAML, pyserial, pydantic, paho-mqtt, dbus-fast, async-timeout, mppsolar, bluepy, bleak
  Attempting uninstall: PyYAML
    Found existing installation: PyYAML 5.3.1
    Not uninstalling pyyaml at /usr/lib/python3/dist-packages, outside environment /usr
    Can't uninstall 'PyYAML'. No files were found to uninstall.
Successfully installed PyYAML-6.0.1 async-timeout-4.0.3 bleak-0.20.2 bluepy-1.3.0 dbus-fast-1.95.2 mppsolar-0.15.62 paho-mqtt-2.0.0 pydantic-1.10.14 pyserial-3.5 strenum-0.4.15 typing-extensions-4.10.0

**root@husb:~# mpp-solar -p C8:47:82:17:3E:36 -c getInfo**

Exception ignored in: <function Client.__del__ at 0x7f84e354c0>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/paho/mqtt/client.py", line 874, in __del__
    self._reset_sockets()
  File "/usr/local/lib/python3.9/dist-packages/paho/mqtt/client.py", line 1133, in _reset_sockets
    self._sock_close()
  File "/usr/local/lib/python3.9/dist-packages/paho/mqtt/client.py", line 1119, in _sock_close
    if not self._sock:
AttributeError: 'Client' object has no attribute '_sock'
Traceback (most recent call last):
  File "/usr/local/bin/mpp-solar", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/dist-packages/mppsolar/__init__.py", line 230, in main
    mqtt_broker = MqttBroker(
  File "/usr/local/lib/python3.9/dist-packages/mppsolar/libs/mqttbrokerc.py", line 44, in __init__
    self.mqttc = mqtt_client.Client()
TypeError: __init__() missing 1 required positional argument: 'callback_api_version'

So I manage to install mpp-solar but it crash instead... Any clue where to go from here ?

Saentist commented 8 months ago

put terminal content in code <>

https://github.com/jblance/mpp-solar/wiki/Detailed-Usage

$ jkbms -p 3C:A5:09:0A:AA:AA -c getInfo
Command: getInfo - BLE Device Information inquiry
------------------------------------------------------------
Parameter                       Value           Unit
Header                          55aaeb90            
Record Type                     03                  
Record Counter                  181                 
Device Model                    JK-BD6A20S          
Hardware Version                10P4.0              
Software Version                4.1.7               
Device Name                     JK-BD6A20S          
Device Passcode                 xxxx                
Unknown1                        200708              
Unknown2                        2006284075          
User Data                       Input Userdata      
Settings Passcode?              xxx         
fableman73 commented 8 months ago

I now installed Python 3.12

and reinstalled mppsolar.

root@husb:~# python -m pip install mppsolar[ble]

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting mppsolar[ble]
  Using cached https://www.piwheels.org/simple/mppsolar/mppsolar-0.16.29-py3-none-any.whl (229 kB)
Collecting bleak<0.21.0,>=0.20.2 (from mppsolar[ble])
  Using cached https://www.piwheels.org/simple/bleak/bleak-0.20.2-py3-none-any.whl (135 kB)
Collecting bluepy<2.0.0,>=1.3.0 (from mppsolar[ble])
  Using cached bluepy-1.3.0-cp312-cp312-linux_aarch64.whl
Collecting paho-mqtt<2.0.0,>=1.6 (from mppsolar[ble])
  Using cached https://www.piwheels.org/simple/paho-mqtt/paho_mqtt-1.6.1-py3-none-any.whl (75 kB)
Collecting pycryptodome<4.0.0,>=3.20.0 (from mppsolar[ble])
  Using cached pycryptodome-3.20.0-cp35-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.metadata (3.4 kB)
Collecting pydantic>=1.8.0 (from mppsolar[ble])
  Using cached https://www.piwheels.org/simple/pydantic/pydantic-2.6.3-py3-none-any.whl (395 kB)
Collecting pyserial>3 (from mppsolar[ble])
  Using cached https://www.piwheels.org/simple/pyserial/pyserial-3.5-py2.py3-none-any.whl (90 kB)
Collecting dbus-fast<2.0.0,>=1.83.0 (from bleak<0.21.0,>=0.20.2->mppsolar[ble])
  Using cached dbus_fast-1.95.2-cp312-cp312-manylinux_2_31_aarch64.whl
Collecting annotated-types>=0.4.0 (from pydantic>=1.8.0->mppsolar[ble])
  Using cached https://www.piwheels.org/simple/annotated-types/annotated_types-0.6.0-py3-none-any.whl (12 kB)
Collecting pydantic-core==2.16.3 (from pydantic>=1.8.0->mppsolar[ble])
  Using cached pydantic_core-2.16.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.metadata (6.5 kB)
Collecting typing-extensions>=4.6.1 (from pydantic>=1.8.0->mppsolar[ble])
  Using cached https://www.piwheels.org/simple/typing-extensions/typing_extensions-4.10.0-py3-none-any.whl (33 kB)
Using cached pycryptodome-3.20.0-cp35-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.1 MB)
Using cached pydantic_core-2.16.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.9 MB)
Installing collected packages: pyserial, paho-mqtt, bluepy, typing-extensions, pycryptodome, dbus-fast, annotated-types, pydantic-core, bleak, pydantic, mppsolar
Successfully installed annotated-types-0.6.0 bleak-0.20.2 bluepy-1.3.0 dbus-fast-1.95.2 mppsolar-0.16.29 paho-mqtt-1.6.1 pycryptodome-3.20.0 pydantic-2.6.3 pydantic-core-2.16.3 pyserial-3.5 typing-extensions-4.10.0

still error..

root@husb:~# mpp-solar -p C8:47:80:07:3E:36 -c getInfo

Traceback (most recent call last):
  File "/usr/local/bin/mpp-solar", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/lib/python3.12/site-packages/mppsolar/__init__.py", line 426, in main
    results = _device.run_command(command=_command)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/mppsolar/devices/device.py", line 92, in run_command
    raw_response = self._port.send_and_receive(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/mppsolar/inout/jkbleio.py", line 38, in send_and_receive
    record_type = command_defn["record_type"]
                  ~~~~~~~~~~~~^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable
fableman73 commented 8 months ago

Its not compatible with python 3.12 ?

Saentist commented 8 months ago

Manual say to use jkbms to get info.

jblance commented 8 months ago

jkbms and mmpsolar are basically the same under the hood

On Mon, 11 Mar 2024 at 11:36, Saentist @.***> wrote:

Manual say to use jkbms to get info.

— Reply to this email directly, view it on GitHub https://github.com/jblance/mpp-solar/issues/476#issuecomment-1987385623, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJVKNX6AMWANITCHLZ3NLTYXTN5TAVCNFSM6AAAAABEOGJQUWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBXGM4DKNRSGM . You are receiving this because you are subscribed to this thread.Message ID: @.***>

jblance commented 8 months ago

still need to see a debug to see whats going on

On Mon, 11 Mar 2024 at 11:37, John Blance @.***> wrote:

jkbms and mmpsolar are basically the same under the hood

On Mon, 11 Mar 2024 at 11:36, Saentist @.***> wrote:

Manual say to use jkbms to get info.

— Reply to this email directly, view it on GitHub https://github.com/jblance/mpp-solar/issues/476#issuecomment-1987385623, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJVKNX6AMWANITCHLZ3NLTYXTN5TAVCNFSM6AAAAABEOGJQUWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBXGM4DKNRSGM . You are receiving this because you are subscribed to this thread.Message ID: @.***>

jblance commented 6 months ago

root@husb:~# mpp-solar -p C8:47:80:07:3E:36 -c getInfo

also need to supply the protocol eg -P JK04 (or jk02)