littleyoda / pysma

(FORK for Developement)
Other
4 stars 4 forks source link

How to install? #1

Closed mschlenstedt closed 5 months ago

mschlenstedt commented 5 months ago

Hi Sven,

great to see that you've improved your old Tripower-X-MQTT script. I would like to integrate it into our LoxBerry project (for Loxone Smarthomes): https://wiki.loxberry.de/

How should I install the pysma lib (globally)? I tried with pip3 as root (we still do not use venv on LoxBerry):

root@loxberrykeller:~# pip3 install git+https://github.com/littleyoda/pysma.git
Collecting git+https://github.com/littleyoda/pysma.git
  Cloning https://github.com/littleyoda/pysma.git to /tmp/pip-req-build-2ro5hqiy
  Running command git clone --filter=blob:none --quiet https://github.com/littleyoda/pysma.git /tmp/pip-req-build-2ro5hqiy
  Resolved https://github.com/littleyoda/pysma.git to commit 381cfac2a15931d59fe08beae4ee6cbb970207b9
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: aiohttp<4,>3.3 in /usr/local/lib/python3.11/dist-packages (from pysma-plus==0.3.4) (3.9.5)
Requirement already satisfied: attrs>18 in /usr/local/lib/python3.11/dist-packages (from pysma-plus==0.3.4) (23.2.0)
Requirement already satisfied: jmespath<2 in /usr/local/lib/python3.11/dist-packages (from pysma-plus==0.3.4) (1.0.1)
Requirement already satisfied: dataclasses-struct>0.8 in /usr/local/lib/python3.11/dist-packages (from pysma-plus==0.3.4) (0.8.2)
Requirement already satisfied: untangle>=1.2.1 in /usr/local/lib/python3.11/dist-packages (from pysma-plus==0.3.4) (1.2.1)
Requirement already satisfied: pymodbus in /usr/local/lib/python3.11/dist-packages (from pysma-plus==0.3.4) (3.6.8)
Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.11/dist-packages (from aiohttp<4,>3.3->pysma-plus==0.3.4) (1.3.1)
Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.11/dist-packages (from aiohttp<4,>3.3->pysma-plus==0.3.4) (1.4.1)
Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.11/dist-packages (from aiohttp<4,>3.3->pysma-plus==0.3.4) (6.0.5)
Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.11/dist-packages (from aiohttp<4,>3.3->pysma-plus==0.3.4) (1.9.4)
Requirement already satisfied: typing-extensions<5.0.0,>=4.5.0 in /usr/local/lib/python3.11/dist-packages (from dataclasses-struct>0.8->pysma-plus==0.3.4) (4.12.2)
Requirement already satisfied: defusedxml<0.8.0,>=0.7.1 in /usr/local/lib/python3.11/dist-packages (from untangle>=1.2.1->pysma-plus==0.3.4) (0.7.1)
Requirement already satisfied: idna>=2.0 in /usr/local/lib/python3.11/dist-packages (from yarl<2.0,>=1.0->aiohttp<4,>3.3->pysma-plus==0.3.4) (3.6)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.
root@loxberrykeller:~#

However, I see a folder named "pysma_plus-0.3.4.dist-info" in /usr/local/lib/python3.11/dist-packages, but no folder with the module itself.

root@loxberrykeller:/usr/local/lib/python3.11/dist-packages# ls -ld pysma*
drwxr-xr-x 2 root root 4096 Jun 22 17:58 pysma_plus-0.3.4.dist-info
root@loxberrykeller:/usr/local/lib/python3.11/dist-packages# 

Your script complained the missing pysma_plus lib:

loxberry@loxberrykeller:~/webfrontend/legacy/tripower/pysma/scripts/pysma2mqtt $ python3 pysma2mqtt.py
Traceback (most recent call last):
  File "/opt/loxberry/webfrontend/legacy/tripower/pysma/scripts/pysma2mqtt/pysma2mqtt.py", line 15, in <module>
    import pysmaplus as pysma
ModuleNotFoundError: No module named 'pysmaplus'
loxberry@loxberrykeller:~/webfrontend/legacy/tripower/pysma/scripts/pysma2mqtt $
mschlenstedt commented 5 months ago

pip3 install --upgrade --force-reinstall pysma-plus

... did the job. Thanks for your work!