fhempy server offline nach neustart

Begonnen von 3dmanipulator, 21 März 2022, 15:48:40

Vorheriges Thema - Nächstes Thema

Superposchi

Rückmeldung zu "sudo -u fhem bash" lautet:
fhem@fhem:~$

Und "pip3 install --upgrade fhempy" gibt folgendes zurück:
Requirement already satisfied: fhempy in /usr/local/lib/python3.9/dist-packages (0.1.535)
Collecting fhempy
  Downloading fhempy-0.1.574-py3-none-any.whl (4.5 MB)
     |████████████████████████████████| 4.5 MB 2.3 MB/s
Requirement already satisfied: importlib-metadata==4.8.1 in /usr/local/lib/python3.9/dist-packages (from fhempy) (4.8.1)
Requirement already satisfied: markdown2==2.4.2 in /usr/local/lib/python3.9/dist-packages (from fhempy) (2.4.2)
Requirement already satisfied: websockets==10.3 in /usr/local/lib/python3.9/dist-packages (from fhempy) (10.3)
Requirement already satisfied: requests==2.26.0 in /usr/local/lib/python3.9/dist-packages (from fhempy) (2.26.0)
Requirement already satisfied: aiohttp[speedups]==3.8.1 in /usr/local/lib/python3.9/dist-packages (from fhempy) (3.8.1)
Requirement already satisfied: zeroconf==0.36.12 in /usr/local/lib/python3.9/dist-packages (from fhempy) (0.36.12)
Requirement already satisfied: pycryptodomex==3.16.0 in /usr/local/lib/python3.9/dist-packages (from fhempy) (3.16.0)
Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.9/dist-packages (from aiohttp[speedups]==3.8.1->fhempy) (1.3.1)
Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.9/dist-packages (from aiohttp[speedups]==3.8.1->fhempy) (22.2.0)
Requirement already satisfied: charset-normalizer<3.0,>=2.0 in /usr/local/lib/python3.9/dist-packages (from aiohttp[speedups]==3.8.1->fhempy) (2.0.12)
Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.9/dist-packages (from aiohttp[speedups]==3.8.1->fhempy) (1.8.2)
Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.9/dist-packages (from aiohttp[speedups]==3.8.1->fhempy) (6.0.3)
Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.9/dist-packages (from aiohttp[speedups]==3.8.1->fhempy) (1.3.3)
Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in /usr/local/lib/python3.9/dist-packages (from aiohttp[speedups]==3.8.1->fhempy) (4.0.2)
Requirement already satisfied: cchardet in /usr/local/lib/python3.9/dist-packages (from aiohttp[speedups]==3.8.1->fhempy) (2.1.7)
Requirement already satisfied: Brotli in /usr/local/lib/python3.9/dist-packages (from aiohttp[speedups]==3.8.1->fhempy) (1.0.9)
Requirement already satisfied: aiodns in /usr/local/lib/python3.9/dist-packages (from aiohttp[speedups]==3.8.1->fhempy) (3.0.0)
Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.9/dist-packages (from importlib-metadata==4.8.1->fhempy) (3.11.0)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/lib/python3/dist-packages (from requests==2.26.0->fhempy) (1.26.5)
Requirement already satisfied: idna<4,>=2.5 in /usr/lib/python3/dist-packages (from requests==2.26.0->fhempy) (2.10)
Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python3/dist-packages (from requests==2.26.0->fhempy) (2020.6.20)
Requirement already satisfied: ifaddr>=0.1.7 in /usr/lib/python3/dist-packages (from zeroconf==0.36.12->fhempy) (0.1.7)
Requirement already satisfied: pycares>=4.0.0 in /usr/local/lib/python3.9/dist-packages (from aiodns->aiohttp[speedups]==3.8.1->fhempy) (4.3.0)
Requirement already satisfied: cffi>=1.5.0 in /usr/local/lib/python3.9/dist-packages (from pycares>=4.0.0->aiodns->aiohttp[speedups]==3.8.1->fhempy) (1.15.1)
Requirement already satisfied: pycparser in /usr/local/lib/python3.9/dist-packages (from cffi>=1.5.0->pycares>=4.0.0->aiodns->aiohttp[speedups]==3.8.1->fhempy) (2.21)
Installing collected packages: fhempy
  Attempting uninstall: fhempy
    Found existing installation: fhempy 0.1.535
    Uninstalling fhempy-0.1.535:
      Successfully uninstalled fhempy-0.1.535
Successfully installed fhempy-0.1.574


Nach Restart und Update von Fhempy_local und Fhempyserver_15733 steht im Log von heute folgendes:
2023-01-24 18:47:45,411 - INFO     - fhempy.lib.fhem_pythonbinding: Starting fhempy 0.1.535...
2023-01-24 18:47:45,424 - INFO     - fhempy.lib.fhem_pythonbinding: Waiting for FHEM connection
2023-01-24 18:47:45,510 - INFO     - websockets.server: server listening on 0.0.0.0:15733


Vorher war das Log komplett leer.

Was ich jetzt nicht verstehe ist, dass er nach den Terminal-Befehlen die Version 0.1.535 offenbar deinstalliert und 0.1.574 installiert hat, über die Fhemoberfläche aber im Log wieder 0.1.535 drin steht.

Hab dann mal den Fhem-Server komplett neu gestartet und im Logfile von Fhem steht folgendes:
2023.01.24 18:54:45.713 1: FHEMWEB SSL/HTTPS error:  SSL accept attempt failed error:1408F09C:SSL routines:ssl3_get_record:http request (peer: 192.168.178.209)
2023.01.24 18:54:48.553 1: fhempy_local: Can't connect to ws:localhost:15733: DNS 127.0.0.11 timed out
2023.01.24 18:54:48.553 1: BindingsIo (fhempy_local): ERROR during connection setup: DNS 127.0.0.11 timed out


Im Fhempy-Log wurde noch mal das gleiche eingetragen wie zuvor.

dominik

Eben, du hast 2 fhempy Versionen!

Wo schaust du ins Log rein, wo liegt das?

Mach auch mal ein
sudo find / -name fhempy
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

Superposchi

Aber nur jeweils ein device für Server und das local. Also wie und wo ist das 2. Fhempy und wie kann ich darauf zugreifen?

die Auszüge sind aus dem Log das Fhem selbst bzw Fhempy in das .log-Verzeichnis schreibt. Genauso wie es auch in dem Device eingetragen ist.

Die Ausgabe zu dem Befehl lautet:
/opt/fhem/FHEM/bindings/python/bin/fhempy
/opt/fhem/.local/lib/python3.9/site-packages/fhempy
/opt/fhem/.local/bin/fhempy
/opt/fhem/restoreDir/update/2022-12-21/FHEM/bindings/python/bin/fhempy
find: '/proc/11101/map_files': Permission denied
find: '/proc/11404/map_files': Permission denied
find: '/proc/11726/map_files': Permission denied
find: '/proc/27035/map_files': Permission denied
find: '/proc/27037/map_files': Permission denied
find: '/proc/27069/map_files': Permission denied
/usr/local/bin/fhempy
/usr/local/lib/python3.9/dist-packages/fhempy

dominik

Mhm...da haben wir schon den Übeltäter. Du hast fhempy mit sudo installiert. Das steht und stand nie im Readme. Bitte niemals sudo verwenden, fhempy benötigt kein root!

sudo pip3 uninstall fhempy
sudo -u fhem bash
pip3 install --upgrade fhempy
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

Superposchi

Ok, auf "sudo pip3 uninstall fhempy" kommt die Ausgabe:
Found existing installation: fhempy 0.1.574
Uninstalling fhempy-0.1.574:
  Would remove:
    /usr/local/bin/fhempy
    /usr/local/lib/python3.9/dist-packages/fhempy-0.1.574.dist-info/*
    /usr/local/lib/python3.9/dist-packages/fhempy/*
    /usr/local/lib/python3.9/dist-packages/tests/*
Proceed (y/n)? y
  Successfully uninstalled fhempy-0.1.574


Das "sudo -u fhem bash" gibt zurück:
fhem@fhem:~$

Das "pip3 install --upgrade fhempy" gibt zurück:
Collecting fhempy
  Downloading fhempy-0.1.575-py3-none-any.whl (4.5 MB)
     |████████████████████████████████| 4.5 MB 7.1 MB/s
Requirement already satisfied: importlib-metadata==4.8.1 in /usr/local/lib/python3.9/dist-packages (from fhempy) (4.8.1)
Requirement already satisfied: aiohttp[speedups]==3.8.1 in /usr/local/lib/python3.9/dist-packages (from fhempy) (3.8.1)
Requirement already satisfied: markdown2==2.4.2 in /usr/local/lib/python3.9/dist-packages (from fhempy) (2.4.2)
Requirement already satisfied: zeroconf==0.36.12 in /usr/local/lib/python3.9/dist-packages (from fhempy) (0.36.12)
Requirement already satisfied: pycryptodomex==3.16.0 in /usr/local/lib/python3.9/dist-packages (from fhempy) (3.16.0)
Requirement already satisfied: websockets==10.3 in /usr/local/lib/python3.9/dist-packages (from fhempy) (10.3)
Requirement already satisfied: requests==2.26.0 in /usr/local/lib/python3.9/dist-packages (from fhempy) (2.26.0)
Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.9/dist-packages (from aiohttp[speedups]==3.8.1->fhempy) (6.0.3)
Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in /usr/local/lib/python3.9/dist-packages (from aiohttp[speedups]==3.8.1->fhempy) (4.0.2)
Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.9/dist-packages (from aiohttp[speedups]==3.8.1->fhempy) (1.3.3)
Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.9/dist-packages (from aiohttp[speedups]==3.8.1->fhempy) (1.8.2)
Requirement already satisfied: charset-normalizer<3.0,>=2.0 in /usr/local/lib/python3.9/dist-packages (from aiohttp[speedups]==3.8.1->fhempy) (2.0.12)
Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.9/dist-packages (from aiohttp[speedups]==3.8.1->fhempy) (22.2.0)
Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.9/dist-packages (from aiohttp[speedups]==3.8.1->fhempy) (1.3.1)
Requirement already satisfied: cchardet in /usr/local/lib/python3.9/dist-packages (from aiohttp[speedups]==3.8.1->fhempy) (2.1.7)
Requirement already satisfied: aiodns in /usr/local/lib/python3.9/dist-packages (from aiohttp[speedups]==3.8.1->fhempy) (3.0.0)
Requirement already satisfied: Brotli in /usr/local/lib/python3.9/dist-packages (from aiohttp[speedups]==3.8.1->fhempy) (1.0.9)
Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.9/dist-packages (from importlib-metadata==4.8.1->fhempy) (3.11.0)
Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python3/dist-packages (from requests==2.26.0->fhempy) (2020.6.20)
Requirement already satisfied: idna<4,>=2.5 in /usr/lib/python3/dist-packages (from requests==2.26.0->fhempy) (2.10)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/lib/python3/dist-packages (from requests==2.26.0->fhempy) (1.26.5)
Requirement already satisfied: ifaddr>=0.1.7 in /usr/lib/python3/dist-packages (from zeroconf==0.36.12->fhempy) (0.1.7)
Requirement already satisfied: pycares>=4.0.0 in /usr/local/lib/python3.9/dist-packages (from aiodns->aiohttp[speedups]==3.8.1->fhempy) (4.3.0)
Requirement already satisfied: cffi>=1.5.0 in /usr/local/lib/python3.9/dist-packages (from pycares>=4.0.0->aiodns->aiohttp[speedups]==3.8.1->fhempy) (1.15.1)
Requirement already satisfied: pycparser in /usr/local/lib/python3.9/dist-packages (from cffi>=1.5.0->pycares>=4.0.0->aiodns->aiohttp[speedups]==3.8.1->fhempy) (2.21)
Installing collected packages: fhempy
Successfully installed fhempy-0.1.575


Danach sicherheitshalber den Fhem-Server neugestartet.

Im Startlog des Fhem-Servers steht nach wie vor:
2023.01.24 21:12:41.947 1: fhempy_local: Can't connect to ws:localhost:15733: DNS 127.0.0.11 timed out
2023.01.24 21:12:41.947 1: BindingsIo (fhempy_local): ERROR during connection setup: DNS 127.0.0.11 timed out


Im Fhempy-Log steht jetzt allerdings etliche Male:
Traceback (most recent call last):
  File "/opt/fhem/FHEM/bindings/python/bin/fhempy", line 162, in <module>
    fpb.run()
  File "/opt/fhem/.local/lib/python3.9/site-packages/fhempy/lib/fhem_pythonbinding.py", line 708, in run
    loop.run_until_complete(async_main())
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/opt/fhem/.local/lib/python3.9/site-packages/fhempy/lib/fhem_pythonbinding.py", line 616, in async_main
    async with websockets.serve(
  File "/opt/fhem/.local/lib/python3.9/site-packages/websockets/legacy/server.py", line 1070, in __aenter__
    return await self
  File "/opt/fhem/.local/lib/python3.9/site-packages/websockets/legacy/server.py", line 1088, in __await_impl__
    server = await self._create_server()
  File "/usr/lib/python3.9/asyncio/base_events.py", line 1494, in create_server
    raise OSError(err.errno, 'error while attempting '
OSError: [Errno 98] error while attempting to bind on address ('0.0.0.0', 15733): address already in use
2023-01-24 21:12:35,865 - INFO     - fhempy.lib.fhem_pythonbinding: Starting fhempy 0.1.535...
2023-01-24 21:12:35,867 - INFO     - fhempy.lib.fhem_pythonbinding: Waiting for FHEM connection
2023-01-24 21:12:35,883 - INFO     - websockets.server: server listening on 0.0.0.0:15733[code]

Im Fhempy_local steht weiterhin "Installing fhempy (15min)." im STATE. Auch haben wie vorher beide Devices (Server und local) den grünen Punkt.

dominik

Ich habe das Gefühl, dass du ein ziemliches Chaos auf deinem System hast. Magst du das nicht mal sauber aufsetzen?

Warum installiert der User fhem etwas in /usr/local/lib...? Das sollte eigentlich nicht das Home Verzeichnis von FHEM sein.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

Superposchi

Das System ist ja "gerade eben" erst neu aufgesetzt.
Seit dem existieren ja erst die Probleme.

Aber ja, denke ich schon länger drüber nach, doch mir fehlt leider aktuell die Zeit dafür.

Die Frage mit dem Installieren in das Verzeichnis kann ich nicht beantworten. Dazu reichen meine Kenntnisse nicht aus.

dominik

Wenn du wenig Know-How in dem Bereich hast, dann mach es doch mal ganz simpel und nicht kompliziert...
also Raspberry Pi mit FHEM drauf und gut ist. Kein NAS und Docker, das ist immer Spezialhardware und auch Docker muss man verstehen.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

Superposchi

Naja, ehrlich gesagt denke ich das ein RasPi nicht weniger kompliziert ist, denn davon habe ich genauso wenig Ahnung.
Außerdem sehe ich das Problem eher in meinem Unverständnis gegenüber Linux. Ich komme einfach nicht mit den nichtssagend Ausgaben zurecht. Zumindest finde ich sie unverständlich.

Sicher ist Docker etwas spezielleres, dafür ist das NAS aus verschiedenen Gründen angeschafft worden und verursacht so keine neuen Anschaffungskosten.

Aber wenn ich das jetzt richtig interpretiere weißt du auch nicht mehr weiter und gibst auf, oder?

dominik

mach
sudo pip3 uninstall fhempy
danach
fhempy Neustart in FHEM machen und das Log nochmals anschauen
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

Superposchi

Also der Befehl "sudo pip3 uninstall fhempy" ergibt die gleiche Ausgabe wie beim ersten Mal:
Found existing installation: fhempy 0.1.575
Uninstalling fhempy-0.1.575:
  Would remove:
    /usr/local/bin/fhempy
    /usr/local/lib/python3.9/dist-packages/fhempy-0.1.575.dist-info/*
    /usr/local/lib/python3.9/dist-packages/fhempy/*
    /usr/local/lib/python3.9/dist-packages/tests/*
Proceed (y/n)? y
  Successfully uninstalled fhempy-0.1.575


Das verstehe ich allerdings nicht, wenn er es beim ersten Mal deinstalliert hat wie kann er es dann jetzt erneut deinstallieren?

Das steht jetzt im Fhempy-Log von heute
OSError: [Errno 98] error while attempting to bind on address ('0.0.0.0', 15733): address already in use
2023-01-24 21:12:35,865 - INFO     - fhempy.lib.fhem_pythonbinding: Starting fhempy 0.1.535...
2023-01-24 21:12:35,867 - INFO     - fhempy.lib.fhem_pythonbinding: Waiting for FHEM connection
2023-01-24 21:12:35,883 - INFO     - websockets.server: server listening on 0.0.0.0:15733
2023-01-24 21:16:25,608 - INFO     - fhempy.lib.fhem_pythonbinding: Starting fhempy 0.1.535...
2023-01-24 21:16:25,610 - INFO     - fhempy.lib.fhem_pythonbinding: Waiting for FHEM connection
2023-01-24 21:16:25,626 - INFO     - websockets.server: server listening on 0.0.0.0:15733
2023-01-24 21:16:28,183 - INFO     - fhempy.lib.fhem_pythonbinding: Starting fhempy 0.1.535...
2023-01-24 21:16:28,185 - INFO     - fhempy.lib.fhem_pythonbinding: Waiting for FHEM connection
2023-01-24 21:16:28,201 - INFO     - websockets.server: server listening on 0.0.0.0:15733

2023-01-24 23:05:41,672 - INFO     - fhempy.lib.fhem_pythonbinding: Starting fhempy 0.1.535...
2023-01-24 23:05:41,674 - INFO     - fhempy.lib.fhem_pythonbinding: Waiting for FHEM connection
2023-01-24 23:05:41,689 - INFO     - websockets.server: server listening on 0.0.0.0:15733

Die Leerzeile ist von mir und signalisiert den Zeitpunkt des Restarts.
Was mich irritiert ist, dass er immer wieder auf die 535 geht.

dominik

Das Problem ist die eigenartige Installation nach /usr/local. Eigentlich sollte fhem dort gar keine Rechte haben zu installieren.

Lösch mal das Verzeichnis hier:
rm -rf /opt/fhem/.local/lib/python3.9/site-packages/fhempy

und starte dann wieder neu. Poste dann wieder das Log.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

Superposchi

Ist es nicht sinnvoller fhempy mal komplett zu löschen und alle Spuren zu eliminieren um dann von Grund auf neu zu installieren?

dominik

Nein, bitte probier das vorher beschriebene
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

Superposchi

So, habe ich gemacht. Die Rückmeldung ist nur ein leeres Fenster, der Ordner selbst ist aber gelöscht. Habe ich im Exlorer kontrolliert.
Dabei ist mir aufgefallen, dass in dem Verzeichnis neben fhempy auch ein Ordner Namens "fhempy-0.1.535.dist-info" existiert.

Ist der vielleicht dafür verantwortlich, dass das Update irgendwie nicht richtig ankommt?