fhempy: googlecast

Begonnen von dominik, 04 Dezember 2020, 23:33:53

Vorheriges Thema - Nächstes Thema

JF Mennedy

Ja da war was mit den Anführungszeichen... Wenn Du einen youtube link unter den Favoriten abspeicherst, brauchst Du die nicht... Gruppenfunktion und GoogleCast ist leider durch eine erfolgreiche Patent Verletzungsklage seitens Sonos gegen Google eingeschränkt worden.. Ich weiß zwar nicht genau in wie weit, betätigt jedoch ist die Steuerung der Lautstärke einer Gruppe...

Patrix2911

Hallo Dominik,

auch von mir dank & lob. Nach einigen Googlen Anfragen hab ich FhemPy nun auch zum laufen gebracht ... endlich, einfach wars nicht. :(

Ich hätte allerdings 2 Anmerkungen,

1) kann man die Sprachgeschwindigkeit irgendwie ändern, ich weiss nicht ob das bei allen Usern so ist, aber bei mir redet Google wenn ich Ausgaben über Fhem mache wirklich extrem langsam

2) Spotify ist ja integriert, kommt Deezer vllt. auch?

OiledAmoeba

Zitat von: scank am 28 Dezember 2021, 20:21:04
Hallo,

hatte fhempy schon seit einigen tagen auf meinem Raspberry4 Buster schon einige Tage am Laufen.
Jetzt bekomme ich folgende Fehlermeldung im tuy cloud connector:
   

Failed to load module tuya_cloud: Traceback (most recent call last):
  File "/opt/fhem/.local/lib/python3.7/site-packages/fhempy/lib/fhem_pythonbinding.py", line 301, in _onMessage
    functools.partial(importlib.import_module, pymodule)
  File "/opt/fhem/.local/lib/python3.7/site-packages/fhempy/lib/utils.py", line 33, in run_blocking
    return await asyncio.get_event_loop().run_in_executor(pool, function)
  File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/opt/fhem/.local/lib/python3.7/site-packages/fhempy/lib/tuya_cloud/tuya_cloud.py", line 5, in <module>
    from fhempy.lib.tuya_cloud.tuya_cloud_device import tuya_cloud_device
  File "/opt/fhem/.local/lib/python3.7/site-packages/fhempy/lib/tuya_cloud/tuya_cloud_device.py", line 5, in <module>
    from tuya_iot.device import TuyaDevice
  File "/opt/fhem/.local/lib/python3.7/site-packages/tuya_iot/__init__.py", line 2, in <module>
    from .device import TuyaDevice, TuyaDeviceListener, TuyaDeviceManager
  File "/opt/fhem/.local/lib/python3.7/site-packages/tuya_iot/device.py", line 7, in <module>
    from typing import Any, Literal, Optional
ImportError: cannot import name 'Literal' from 'typing' (/usr/lib/python3.7/typing.py)

Das hat mit Buster, bzw. Python 3.7, zu tun. Die im Raspbian-Repo hinterlegte Version von "typing" ist zu alt. 'Literal' kommt hier mit py3.8. Ausweg: "typing_extensions" verwenden.
Installieren mit sudo pip install typing_extensions

Dann die Datei /opt/fhem/.local/lib/python3.7/site-packages/tuya_iot/device.py im Editor der Wahl öffnen, Zeile 7 ändern und Zeile 8 ergänzen:


  7 from typing import Any, Optional
  8 from typing_extensions import Literal
Gruß
Florian

Jail auf XigmaNAS (freeBSD); CCU2 mit CULv3, nanoCUL868 und JeeLink-Clone; div. FS20-Komponenten; andFHEM; div. hm- und hmip-Komponenten; div. IT+

bartman121

#393
Hallo,

ich hoffe ich bin jetzt hier im richtigen Thread, ansonsten verjagt mich bitte.

Ich habe jetzt festgestellt, dass ich meine Proxmox-Maschine nicht mehr sauber neustarten kann, proxmox rennt in einen Timeout, auch das Neustarten innerhalb der vm mittels "shutdown -r now" bzw. "reboot" dauert ewig. Ich habe micht jetzt ein wenig auf die Suche begeben und vermute fhempy als Ursache. Zumindest lässt:

journalctl -rb -1 darauf schließen, hier mal der relevante Teil...(Von unten nach oben ist die richtige Reihenfolge!)


May 26 20:41:09 fhem systemd[1]: Stopped FHEM Home Automation.
May 26 20:41:09 fhem systemd[1]: fhem.service: Failed with result 'timeout'.
May 26 20:41:09 fhem systemd[1]: fhem.service: Killing process 40873 (python3) with signal SIGKILL.
May 26 20:41:09 fhem systemd[1]: fhem.service: Killing process 40861 (python3) with signal SIGKILL.
May 26 20:41:09 fhem systemd[1]: fhem.service: Killing process 40857 (python3) with signal SIGKILL.
May 26 20:41:09 fhem systemd[1]: fhem.service: Killing process 40827 (python3) with signal SIGKILL.
May 26 20:41:09 fhem systemd[1]: fhem.service: Killing process 4776 (python3) with signal SIGKILL.
May 26 20:41:09 fhem systemd[1]: fhem.service: Killing process 4775 (python3) with signal SIGKILL.
May 26 20:41:09 fhem systemd[1]: fhem.service: Killing process 4772 (python3) with signal SIGKILL.
May 26 20:41:09 fhem systemd[1]: fhem.service: Killing process 4766 (python3) with signal SIGKILL.
May 26 20:41:09 fhem systemd[1]: fhem.service: Killing process 4637 (python3) with signal SIGKILL.
May 26 20:41:09 fhem systemd[1]: fhem.service: State 'stop-final-sigterm' timed out. Killing.


irgendwie scheinen die python-Prozesse beharrlich das "bitte stop" zu ignorieren und warten auf "kill -f", das würde ich gern irgendwie abstellen, habt ihr Ansätze wo das Problem liegen könnte?

In der Datei "/etc/systemd/system.conf" ist der Parameter "DefaultTimeoutStopSec=120s" eingestellt, das ist so gewollt, am Ende spielt es keine Rolle ob ich 120s oder 300s Eintrage, die python-Prozesse warten beharrlich auf das Timeout.

Es könnte sicher auch nicht schaden noch ein list vom pyBinding-Device zu posten:

Internals:
   BindingType Python
   DEF        Python
   DeviceName ws:127.0.0.1:15733
   FD         58
   FUUID      5fca276b-f33f-1dd6-f9e1-19062dfa87ed420c
   IP         127.0.0.1
   NAME       pyBinding
   NR         170
   NTFY_ORDER 50-pyBinding
   PARTIAL   
   PORT       15733
   STATE      opened
   TYPE       BindingsIo
   WEBSOCKET  1
   localBinding 1
   nextOpenDelay 10
   Helper:
     DBLOG:
       hostname:
         logdb:
           TIME       1653590509.50736
           VALUE      fhem
       os:
         logdb:
           TIME       1653590509.47941
           VALUE      posix
       python:
         logdb:
           TIME       1653590509.49973
           VALUE      3.8.10
       release:
         logdb:
           TIME       1653590509.50152
           VALUE      5.4.0-113-generic
       state:
         logdb:
           TIME       1653590509.56277
           VALUE      CONNECTED
       system:
         logdb:
           TIME       1653590509.47641
           VALUE      Linux
       version:
         logdb:
           TIME       1653590509.47469
           VALUE      0.1.358
   READINGS:
     2022-05-26 20:41:49   hostname        fhem
     2021-05-30 20:04:44   info            ready
     2022-05-26 20:41:49   os              posix
     2022-05-26 20:41:49   python          3.8.10
     2022-05-26 20:41:49   release         5.4.0-113-generic
     2022-05-26 20:41:49   state           opened
     2022-05-26 20:41:49   system          Linux
     2022-05-26 20:41:49   version         0.1.358
   args:
     pyBinding
     BindingsIo
     Python
   argsh:
Attributes:
   devStateIcon {      my $status_img = "10px-kreis-gruen";;      my $status_txt = "connected";;      if (ReadingsVal($name, "state", "disconnected") eq "disconnected") {        $status_img = "10px-kreis-rot";;        $status_txt = "disconnected";;      }      my $ver = ReadingsVal($name, "version", "-");;      "<div><a>".FW_makeImage($status_img, $status_txt)."</a><a> ".$ver." </a><a  href=\"/fhem?cmd.dummy=set $name update&XHR=1\" title=\"Start update\">".FW_makeImage("refresh")."</a></div>"    }
   group      fhempy
   icon       file_json-ld2
   room       fhempy
   verbose    0


Viele Grüße

Andreas


bartman121

Hallo,

ich verweise nochmal auf obiges Problem... Hat jemand eine Idee dazu?

Grüße

Andreas

SouzA

Zitat von: bartman121 am 06 Juni 2022, 18:54:30
Hallo,

ich verweise nochmal auf obiges Problem... Hat jemand eine Idee dazu?

Grüße

Andreas

Hallo,

zu deinem Problem direkt nicht.
Aber du kriegst den Modulersteller, so denke ich, besser über Github.
Da nen Issue aufmachen und mal gucken.
Habe den Eindruck, dass Dominik nicht so oft hier im Forum ist. Bei dem, was der alles Programmiert auch verständlich... :D

https://github.com/dominikkarall/fhempy/issues

Bis denn
SouzA
Raspi 4, EnOcean TCM310 USB, HM-MOD-UART-USB, Jeelink, hue, AMAD, fully, FRITZBOX, Signalbot, VIERA, Presence BT/Mac, TPLink, Gassistant, Shelly, fhempy, ZigBee

Henno

Hallo zusammen,

da ich die Tage nach mehreren Monaten nochmal mein FHEM aktualisiert habe (never touch a running system!)
Habe ich nun Probleme mit fhempy.

Alle Altlasten habe ich gelöscht, nach readme aus GitHub neu eingerichtet, jedoch startet es nicht mehr.
Irgendwo fehlen vermutlich rechte...

  ERROR: Failed building wheel for dbus-python
ERROR: async-upnp-client 0.20.0 has requirement async-timeout<4.0,>=3.0, but you'll have async-timeout 4.0.2 which is incompatible.
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/root/.local'
Check the permissions.
2022-08-06 12:14:52,547 - ERROR    - __main__: Failed to install fhempy, exit now...


FHEM läuft auf Ubuntu 20.04.4 auf einem i3

dominik

Hi,

mach bitte mal
sudo -u fhem bash
pip3 install fhempy

Poste dann den Output.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

Henno

sudo -u fhem bash
fordert nur zur Passworteingabe auf, nachdem ich das PW für den verwendeten user (nicht root) eingegeben habe, erfolgt keine weitere Ausgabe.

pip3 install fhempy

Startet die Installation von fhempy, scheint auch erfolgreich zu sein:

Installing collected packages: fhempy
Successfully installed fhempy-0.1.392


Ich hatte es so verstanden das man im System selbst fhempy nicht mehr installiert sondern dies über FHEM geschieht.

Auch nach der Installation sowie reboot bleibt im log:
2022.08.07 11:06:47 1: BindingsIo (fhempy_local): ERROR fhempy_local - error while connecting: 127.0.0.1: Connection refused (111)








dominik

Ich habe das Gefühl, dass du irgendwo mal mit root gearbeitet hast, wo man es nicht sollte.

Nachdem fhempy jetzt erfolgreich für den User fhem installiert wurde, starte mal dein FHEM neu und poste mir dann bitte /opt/fhem/log/fhempy....log.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

Henno

Nach neustart von FHEM:


2022-08-07 11:25:22,156 - ERROR    - __main__: Failed to load fhempy
Traceback (most recent call last):
  File "FHEM/bindings/python/bin/fhempy", line 100, in <module>
    import fhempy.lib.fhem_pythonbinding as fpb
ModuleNotFoundError: No module named 'fhempy'
2022-08-07 11:25:22,157 - INFO     - __main__: Attempting install of fhempy>=0.1.12
2022-08-07 11:25:41,458 - ERROR    - __main__: Unable to install package fhempy>=0.1.12: WARNING: The directory '/root/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
ERROR: async-upnp-client 0.20.0 has requirement async-timeout<4.0,>=3.0, but you'll have async-timeout 4.0.2 which is incompatible.
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/root/.local'
Check the permissions.
2022-08-07 11:25:41,458 - ERROR    - __main__: Failed to install fhempy, exit now...

dominik

Mit welchem User läuft fhem?
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

Henno


Henno

#403
Nachdem ich als user fhem über die Konsole async-upnp-client==0.31.2 installiert habe, läuft fhempy nun zwar aber es fehlen nun sämtliche Module.

z.B.:
2022-08-07 11:48:07,268 - ERROR    - fhempy.lib.pkg_installer: Unable to install package pychromecast==12.1.4: WARNING: The directory '/root/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

Natürlich kann ich diese jetzt alle von Hand installieren, aber das ist ja auch nicht sinn der Sache.



2022-08-07 11:50:41,420 - INFO     - fhempy.lib.fhem_pythonbinding: Start update...
2022-08-07 11:50:41,421 - INFO     - fhempy.lib.pkg_installer: Attempting install of fhempy
2022-08-07 11:50:43,166 - ERROR    - fhempy.lib.pkg_installer: Unable to install package fhempy: WARNING: The directory '/root/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
/usr/local/lib/python3.8/dist-packages/cryptography/hazmat/backends/openssl/x509.py:14: CryptographyDeprecationWarning: This version of cryptography contains a temporary pyOpenSSL fallback path. Upgrade pyOpenSSL now.
  warnings.warn(
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/root/.local'
Check the permissions.
2022-08-07 11:50:43,549 - INFO     - fhempy.lib.fhem_pythonbinding: Start update...
2022-08-07 11:50:43,550 - INFO     - fhempy.lib.pkg_installer: Attempting install of fhempy
2022-08-07 11:50:43,571 - INFO     - fhempy.lib.fhem_pythonbinding: Restart initiated...
2022-08-07 11:50:43,578 - INFO     - fhempy.lib.fhem_pythonbinding: All modules successfully undefined!
2022-08-07 11:50:43,580 - INFO     - websockets.server: server closing
2022-08-07 11:50:44,624 - INFO     - fhempy.lib.fhem_pythonbinding: Shutdown initiated...
2022-08-07 11:50:44,628 - ERROR    - zeroconf: Failed to remove listener: ValueError('list.remove(x): x not in list')
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/zeroconf/_handlers.py", line 530, in async_remove_listener
    self.listeners.remove(listener)
ValueError: list.remove(x): x not in list
2022-08-07 11:50:44,629 - ERROR    - zeroconf: Failed to remove listener: ValueError('list.remove(x): x not in list')
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/zeroconf/_handlers.py", line 530, in async_remove_listener
    self.listeners.remove(listener)
ValueError: list.remove(x): x not in list
2022-08-07 11:50:44,629 - ERROR    - zeroconf: Failed to remove listener: ValueError('list.remove(x): x not in list')
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/zeroconf/_handlers.py", line 530, in async_remove_listener
    self.listeners.remove(listener)
ValueError: list.remove(x): x not in list
2022-08-07 11:50:44,630 - INFO     - fhempy.lib.fhem_pythonbinding: All modules successfully undefined!
2022-08-07 11:50:45,269 - ERROR    - fhempy.lib.pkg_installer: Unable to install package fhempy: WARNING: The directory '/root/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
/usr/local/lib/python3.8/dist-packages/cryptography/hazmat/backends/openssl/x509.py:14: CryptographyDeprecationWarning: This version of cryptography contains a temporary pyOpenSSL fallback path. Upgrade pyOpenSSL now.
  warnings.warn(
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/root/.local'
Check the permissions.
2022-08-07 11:50:49,246 - INFO     - fhempy.lib.fhem_pythonbinding: Starting fhempy 0.1.392...
2022-08-07 11:50:49,247 - INFO     - fhempy.lib.fhem_pythonbinding: Waiting for FHEM connection
2022-08-07 11:50:49,259 - INFO     - websockets.server: server listening on 0.0.0.0:15733




fhempy server wird online gezeigt jedoch sind alle googlecast offline


Edit 2:

Ich habe nun alles manuell installier, jetzt läuft alles ordnungsgemäß.


dominik

ZitatWARNING: The directory '/root/.cache/pip'
Das war das Problem, irgendwas ist mit root installiert worden, weshalb der fhem User das nicht mehr bearbeiten konnte.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik