nmakel / solaredge_modbus

SolarEdge Modbus data collection library
MIT License
147 stars 36 forks source link

Having trouble setting it up #60

Closed JohnBons closed 2 years ago

JohnBons commented 2 years ago

Thanks for the effort of making this all available.

I'm running into an issue setting it up om my raspberry. Telnet is working on port 1502

raspberrypi:~/modbus/solaredge_modbus $ telnet 192.168.2.7 1502
Trying 192.168.2.7...
Connected to 192.168.2.7.
Escape character is '^]'.

but when i run example.py i get this output

raspberrypi:~/modbus/solaredge_modbus $ ./example.py 192.168.2.7 1502
Traceback (most recent call last):
  File "/home/bonsj/modbus/solaredge_modbus/./example.py", line 6, in <module>
    import solaredge_modbus
  File "/usr/local/lib/python3.9/dist-packages/solaredge_modbus/__init__.py", line 7, in <module>
    from pymodbus.client.sync import ModbusTcpClient
  File "/usr/local/lib/python3.9/dist-packages/pymodbus/client/__init__.py", line 5, in <module>
    from pymodbus.client.serial import AsyncModbusSerialClient, ModbusSerialClient
  File "/usr/local/lib/python3.9/dist-packages/pymodbus/client/serial.py", line 7, in <module>
    from serial_asyncio import create_serial_connection
ModuleNotFoundError: No module named 'serial_asyncio'

Running python 3.9

I would expect output. But I assume i am doing something wrong. Can you guide me?

nmakel commented 2 years ago

I would expect output. But I assume i am doing something wrong. Can you guide me?

You're not wrong, the PyModbus folks threw everyone under the bus. They now use pyserial-asyncio, but PIP won't automatically install it for you.

Grab the latest release I just uploaded to PyPi and make sure pyserial-asyncio version 0.6 gets installed.

JohnBons commented 2 years ago

^^ Thanks! fixed !

JohnBons commented 2 years ago

For some reason it is installing the old version(solaredge_modbus-0.7.0) via pip?


@d22ddf8d0389:~/solaredge_modbus# pip3 install solaredge_modbus
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Collecting solaredge_modbus
  Using cached solaredge_modbus-0.7.0-py3-none-any.whl (10 kB)
Requirement already satisfied: pymodbus>=2.4.0 in /usr/local/lib/python3.7/dist-packages (from solaredge_modbus) (2.5.3)
Requirement already satisfied: six>=1.15.0 in /usr/local/lib/python3.7/dist-packages (from pymodbus>=2.4.0->solaredge_modbus) (1.16.0)
Requirement already satisfied: pyserial>=3.4 in /usr/local/lib/python3.7/dist-packages (from pymodbus>=2.4.0->solaredge_modbus) (3.5)
Installing collected packages: solaredge_modbus
Successfully installed solaredge_modbus-0.7.0
nmakel commented 2 years ago

Try python3 -m pip --upgrade install solaredge_modbus.

JohnBons commented 2 years ago

I did the following

root@d22ddf8d0389:/opt/domoticz/plugins# python3 -m pip install solaredge_modbus --no-cache-dir Collecting solaredge_modbus Downloading solaredge_modbus-0.7.0-py3-none-any.whl (10 kB) Requirement already satisfied: pymodbus>=2.4.0 in /usr/local/lib/python3.7/dist-packages (from solaredge_modbus) (2.5.3) Requirement already satisfied: six>=1.15.0 in /usr/local/lib/python3.7/dist-packages (from pymodbus>=2.4.0->solaredge_modbus) (1.16.0) Requirement already satisfied: pyserial>=3.4 in /usr/local/lib/python3.7/dist-packages (from pymodbus>=2.4.0->solaredge_modbus) (3.5) Installing collected packages: solaredge_modbus Successfully installed solaredge_modbus-0.7.0 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv root@d22ddf8d0389:/opt/domoticz/plugins# python3 -m pip install solaredge_modbus --no-cache-dir --upgrade Requirement already satisfied: solaredge_modbus in /usr/local/lib/python3.7/dist-packages (0.7.0) Requirement already satisfied: pymodbus>=2.4.0 in /usr/local/lib/python3.7/dist-packages (from solaredge_modbus) (2.5.3) Requirement already satisfied: six>=1.15.0 in /usr/local/lib/python3.7/dist-packages (from pymodbus>=2.4.0->solaredge_modbus) (1.16.0) Requirement already satisfied: pyserial>=3.4 in /usr/local/lib/python3.7/dist-packages (from pymodbus>=2.4.0->solaredge_modbus) (3.5) WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

So i uninstalled the module installed it without using cache tried to install with --upgrade All option came out with solaredge_modbus-0.7.0

My setup is:
Fresh domoticz docker container I will try other setups

nmakel commented 2 years ago

I just did a fresh python -m pip install solaredge_modbus and a python -m pip download solaredge_modbus, both came up 0.7.2. Can't duplicate, sorry.

JohnBons commented 2 years ago

Found the issue.

Didnt realize that the plugin needed python 3.8 the Domoticz docker image is running python3.7 need to fix that