[Altes Modul] GoogleCast (98_GOOGLECAST.pm)

Begonnen von dominik, 10 Dezember 2015, 22:43:49

Vorheriges Thema - Nächstes Thema

dominik

#120
Update
v1.0.4 - 20170101
- BUGFIX:  support non-blocking chromecast search => kein Blocking mehr beim Suchen
- FEATURE: support all services supported by youtube-dl (if the video/audio format can be decoded by chromecast)
            https://github.com/rg3/youtube-dl/blob/master/docs/supportedsites.md
            playlists not yet supported!

shutdown restart notwendig.

Bugs / Herausforderungen
- Beim Define (also auch beim Starten) wird FHEM für ca. 10s geblockt
- Umlaute für Chromecast Devices funktionieren aktuell nicht
- playYoutube blockiert FHEM für einige Sekunden
- vor jedem Abspielen muss quitApp ausgeführt werden
- Bei jedem Set wird die gesamte FHEM Instanz für ca. 10s geblockt
- Zeitverzögerung des Commands von ca. 10s bei jedem Set Befehl
- Aktuell nur 2 technische Readings
- Ich verwende die pychromecast Library (in Python geschrieben) um auf die Chromecasts zuzugreifen. Leider habe ich noch keine Möglichkeit gefunden die Library so zu verwenden, dass man nicht bei jedem Set den Chromecast komplett neu verbinden muss. Im Python Code funktioniert das, nur in Kombination mit Inline::Python tut es nicht da da scheinbar der Thread im Hintergrund nicht weiterläuft wenn der Perl Code ausgeführt wird. Wenn jemand Ideen hat, gerne melden :)

Requirements - ACHTUNG UPDATE!!!
sudo pip uninstall pychromecast (NEU!)
sudo pip install git+https://github.com/balloob/pychromecast.git (NEU!)
sudo apt-get install libwww-perl
Linux Distribution jessie
sudo pip install youtube-dl
sudo cpanm Inline::Python

Define
define ccWohnzimmer CHROMECAST Wohnzimer
Wohnzimmer = Name des Chromecast Devices

Set
set ccWohnzimmer play https://www.youtube.com/watch?v=tERRFWuYG48
set ccWohnzimmer play http://swr-mp3-m-swr3.akacast.akamaistream.net:80/7/720/137136/v1/gnl.akacast.akamaistream.net/swr-mp3-m-swr3
set ccWohnzimmer play http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4
set ccWohnzimmer pause/play/stop/quitApp

Bugs und Verbesserungsvorschläge bitte direkt hier melden. Wer mir ein kleines Bier zahlen will (oder Pampers finanziert, da ich Vater geworden bin ;)), darf mir gerne per Paypal an dominik.karall@gmail.com etwas transferieren.
Danke euch für das ausführliche Testen!

Gruß,
Dominik
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

alexmetz

vielen Dank für das Update. Stürzt leider immer noch ab:
checkConnection
2017.01.02 07:25:06 5: CHROMECAST (Chromecast): checkConnection
...
2017.01.02 07:46:35 5: CHROMECAST (Chromecast): checkConnection
2017.01.02 07:46:35 5: CHROMECAST (Chromecast): checkConnection
2017.01.02 07:46:36 5: CHROMECAST (Chromecast): checkConnection
2017.01.02 07:46:36 5: CHROMECAST (Chromecast): checkConnection
2017.01.02 07:46:37 5: CHROMECAST (Chromecast): checkConnection
2017.01.02 07:46:37 5: CHROMECAST (Chromecast): checkConnection
2017.01.02 07:46:38 5: CHROMECAST (Chromecast): checkConnection
2017.01.02 07:46:38 5: CHROMECAST (Chromecast): checkConnection
No handlers could be found for logger "pychromecast.socket_client"


Danach war fhem abgestürzt.
LG
Alex
FHEM auf RaspberryPi 4
Homematic

dominik

Kannst du erklären welche Schritte du ausgeführt hast? Ich vermute mal, dass der Chromecast schon mal erkannt wurde und danach offline war, oder?
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

alexmetz

genau. Habe das define gemacht als der Chromecast an war und später dann ausgemacht.

LG
Alex
FHEM auf RaspberryPi 4
Homematic

MartinMW

#124
Hallo dominik, danke für das super Modul!
Brauchte übrigens bei meinem pi 2 noch:
sudo pip install netiface
sudo pip install enum34  (enum32 gab es nicht  ;))

Habe eine Sony CMT-SX7B und Sony SRS-X77. Wenn mit meinem Androidhandy mit GoogleCast eine Multiroom Gruppe eingerichtet habe, kann ich gar die als cc device einrichten. Echt super!!

Danke

VG

Martin

Esjay

Hallo dominik,
erstmal danke,das du dich der Sache angenommen hast,und meinen Glückwunsch zum Nachwuchs.Gestern sind meine Cromecast gekommen,und hab sie direkt versucht in Fhem einzubinden.Allerdings habe ich folgendes im log.Hast du eine Idee dazu?
2017.01.15 11:49:41 3: CHROMECAST: Wohnzimmer initializing...
2017.01.15 11:49:50 1: ERROR evaluating {CHROMECAST_findChromecastsResult('ccWohnzimmer|CCDEVICE|192.168.178.59|8009|d372ca47-74bf-cde9-8ef2-f911853f12f9|Chromecast Audio|Wohnzimmer')}: exceptions.AttributeError: 'module' object has no attribute '_get_chromecast_from_host' at line 13


Gruß Esjay

dominik

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

Esjay

#127
Zitat von: dominik am 15 Januar 2017, 20:16:47
Hast du pychromecast über git installiert?

sudo pip install git+https://github.com/balloob/pychromecast.git

Hallo dominik,

ja, das habe ich so installiert.Vll kannst du ja mehr aus der Ausgabe herauslesen,oder sehen,ob etwas fehltgeschlagen/schiefgegangen oder sonst was ist.


sudo pip install git+https://github.com/balloob/pychromecast.git
Downloading/unpacking git+https://github.com/balloob/pychromecast.git
  Cloning https://github.com/balloob/pychromecast.git to /tmp/pip-ar1h5e6g-build
  Running setup.py (path:/tmp/pip-ar1h5e6g-build/setup.py) egg_info for package from git+https://github.com/balloob/pychromecast.git

    warning: no previously-included files matching '*.py[co]' found under directory '*'
Requirement already satisfied (use --upgrade to upgrade): requests>=2.0 in /usr/lib/python3/dist-packages (from PyChromecast==0.7.7)
Downloading/unpacking protobuf>=3.0.0 (from PyChromecast==0.7.7)
  Downloading protobuf-3.1.0.post1-py2.py3-none-any.whl (347kB): 347kB downloaded
Downloading/unpacking zeroconf>=0.17.4 (from PyChromecast==0.7.7)
  Downloading zeroconf-0.17.6-py2.py3-none-any.whl
Downloading/unpacking six>=1.10.0 (from PyChromecast==0.7.7)
  Downloading six-1.10.0-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/lib/python3/dist-packages (from protobuf>=3.0.0->PyChromecast==0.7.7)
Requirement already satisfied (use --upgrade to upgrade): netifaces in /usr/local/lib/python3.4/dist-packages (from zeroconf>=0.17.4->PyChromecast==0.7.7)
Downloading/unpacking enum-compat (from zeroconf>=0.17.4->PyChromecast==0.7.7)
  Downloading enum-compat-0.0.2.tar.gz
  Running setup.py (path:/tmp/pip-build-49or2850/enum-compat/setup.py) egg_info for package enum-compat

Installing collected packages: protobuf, zeroconf, six, PyChromecast, enum-compat
  Found existing installation: six 1.8.0
    Not uninstalling six at /usr/lib/python3/dist-packages, owned by OS
  Running setup.py install for PyChromecast

    warning: no previously-included files matching '*.py[co]' found under directory '*'
  Running setup.py install for enum-compat
    deleting enum_compat.egg-info/requires.txt

Successfully installed protobuf zeroconf six PyChromecast enum-compat
Cleaning up...


Edit:
Ich habe gestern Abend meinen Cromecast nochmal auf den Namen Test umbenannt,und erneut angelegt.
Nun wurde zusätzlich das Log mit der Meldungen gefüllt.
2017.01.15 23:35:15 3: CHROMECAST: Test initializing...
2017.01.15 23:35:23 1: PERL WARNING: Use of uninitialized value $devName in string eq at ./FHEM/98_CHROMECAST.pm line 162.
2017.01.15 23:35:23 1: PERL WARNING: Use of uninitialized value $devName in concatenation (.) or string at ./FHEM/98_CHROMECAST.pm line 170.
2017.01.15 23:35:33 1: PERL WARNING: Use of uninitialized value $string in split at ./FHEM/98_CHROMECAST.pm line 132.
2017.01.15 23:35:33 1: PERL WARNING: Use of uninitialized value $name in string at ./FHEM/98_CHROMECAST.pm line 133.
2017.01.15 23:35:48 3: CHROMECAST: Test initializing...
2017.01.15 23:35:52 1: PERL WARNING: Use of uninitialized value $string in split at ./FHEM/98_CHROMECAST.pm line 132.
2017.01.15 23:35:52 1: PERL WARNING: Use of uninitialized value $name in string at ./FHEM/98_CHROMECAST.pm line 133.
2017.01.15 23:35:58 1: ERROR evaluating {CHROMECAST_findChromecastsResult('ccTest|CCDEVICE|192.168.178.59|8009|d372ca47-74bf-cde9-8ef2-f911853f12f9|Chromecast Audio|Test')}: exceptions.AttributeError: 'module' object has no attribute '_get_chromecast_from_host' at line 13

Da ich gestern Abend das Device nicht gelöscht habe,ging das die Gamze Nacht so. Vll hilft es ja bei der Diagnose..

Hat nichts mit dem Device an sich zu tun.Die Meldungen treten weiterhin auf!
Grüße

Diektator

Hallo Dominik,

ich hab erst gestern angefangen mir FHEM auf meinem RPi 2b einzurichten und bisher lief alles ganz gut.
Bei deinem Modul spuckt mein Log allerdings folgendes aus, wenn ich meinen Chromecast definen will:

Can't load '/usr/local/lib/arm-linux-gnueabihf/perl/5.20.2/auto/Inline/Python/Python.so' for module Inline::Python: /usr/local/lib/arm-linux-gnueabihf/perl/5.20.2/auto/Inline/Python/Python.so: undefined symbol: PyMethod_Type at /usr/lib/arm-linux-gnueabihf/perl/5.20/DynaLoader.pm line 187.
at -e line 0.
Compilation failed in require at (eval 5) line 1.
2017.01.17 12:39:06 1: reload: Error:Modul 98_CHROMECAST deactivated:
Failed to autogenerate /opt/fhem/_Inline/config-arm-linux-gnueabihf-thread-multi-64int-5.020002.

at ./FHEM/98_CHROMECAST.pm line 446.
BEGIN failed--compilation aborted at ./FHEM/98_CHROMECAST.pm line 446.

2017.01.17 12:39:06 0: Failed to autogenerate /opt/fhem/_Inline/config-arm-linux-gnueabihf-thread-multi-64int-5.020002.

at ./FHEM/98_CHROMECAST.pm line 446.
BEGIN failed--compilation aborted at ./FHEM/98_CHROMECAST.pm line 446.


leider hab ich keine Ahnung, was genau ich falsch gemacht habe. :(

Esjay

Hallo dominik,
ich habe es jetzt hinbekommen,meinen Cromecast einzubinden.Die folgenden Meldungen treten allerdings noch auf!


2017.01.17 21:20:18 1: PERL WARNING: Use of uninitialized value $string in split at ./FHEM/98_CHROMECAST.pm line 132.
2017.01.17 21:20:18 1: PERL WARNING: Use of uninitialized value $name in string at ./FHEM/98_CHROMECAST.pm line 133.
2017.01.17 21:20:36 1: PERL WARNING: Use of uninitialized value $string in split at ./FHEM/98_CHROMECAST.pm line 132.
2017.01.17 21:20:36 1: PERL WARNING: Use of uninitialized value $name in string at ./FHEM/98_CHROMECAST.pm line 133.
2017.01.17 21:20:55 1: PERL WARNING: Use of uninitialized value $string in split at ./FHEM/98_CHROMECAST.pm line 132.
2017.01.17 21:20:55 1: PERL WARNING: Use of uninitialized value $name in string at ./FHEM/98_CHROMECAST.pm line 133.
2017.01.17 21:21:14 1: PERL WARNING: Use of uninitialized value $string in split at ./FHEM/98_CHROMECAST.pm line 132.
2017.01.17 21:21:14 1: PERL WARNING: Use of uninitialized value $name in string at ./FHEM/98_CHROMECAST.pm line 133.
2017.01.17 21:21:33 1: PERL WARNING: Use of uninitialized value $string in split at ./FHEM/98_CHROMECAST.pm line 132.
2017.01.17 21:21:33 1: PERL WARNING: Use of uninitialized value $name in string at ./FHEM/98_CHROMECAST.pm line 133.
2017.01.17 21:21:52 1: PERL WARNING: Use of uninitialized value $string in split at ./FHEM/98_CHROMECAST.pm line 132.
2017.01.17 21:21:52 1: PERL WARNING: Use of uninitialized value $name in string at ./FHEM/98_CHROMECAST.pm line 133.
2017.01.17 21:22:10 1: PERL WARNING: Use of uninitialized value $string in split at ./FHEM/98_CHROMECAST.pm line 132.
2017.01.17 21:22:10 1: PERL WARNING: Use of uninitialized value $name in string at ./FHEM/98_CHROMECAST.pm line 133.
2017.01.17 21:22:29 1: PERL WARNING: Use of uninitialized value $string in split at ./FHEM/98_CHROMECAST.pm line 132.
2017.01.17 21:22:29 1: PERL WARNING: Use of uninitialized value $name in string at ./FHEM/98_CHROMECAST.pm line 133.
2017.01.17 21:22:48 1: PERL WARNING: Use of uninitialized value $string in split at ./FHEM/98_CHROMECAST.pm line 132.
2017.01.17 21:22:48 1: PERL WARNING: Use of uninitialized value $name in string at ./FHEM/98_CHROMECAST.pm line 133.
2017.01.17 21:23:07 1: PERL WARNING: Use of uninitialized value $string in split at ./FHEM/98_CHROMECAST.pm line 132.
2017.01.17 21:23:07 1: PERL WARNING: Use of uninitialized value $name in string at ./FHEM/98_CHROMECAST.pm line 133.
2017.01.17 21:23:26 1: PERL WARNING: Use of uninitialized value $string in split at ./FHEM/98_CHROMECAST.pm line 132.
2017.01.17 21:23:26 1: PERL WARNING: Use of uninitialized value $name in string at ./FHEM/98_CHROMECAST.pm line 133.
2017.01.17 21:23:44 1: PERL WARNING: Use of uninitialized value $string in split at ./FHEM/98_CHROMECAST.pm line 132.
2017.01.17 21:23:44 1: PERL WARNING: Use of uninitialized value $name in string at ./FHEM/98_CHROMECAST.pm line 133.
2017.01.17 21:24:03 1: PERL WARNING: Use of uninitialized value $string in split at ./FHEM/98_CHROMECAST.pm line 132.
2017.01.17 21:24:03 1: PERL WARNING: Use of uninitialized value $name in string at ./FHEM/98_CHROMECAST.pm line 133.
2017.01.17 21:24:22 1: PERL WARNING: Use of uninitialized value $string in split at ./FHEM/98_CHROMECAST.pm line 132.
2017.01.17 21:24:22 1: PERL WARNING: Use of uninitialized value $name in string at ./FHEM/98_CHROMECAST.pm line 133.


Grüße




SoeK

@Esjay: Hast Du evtl. ein Leerzeichen im Namen eines der Favoriten? Dann hatte ich zumindest eine sehr ähnliche Fehlermeldung. Nach umbenennen von "1 Live" in "1Live" und Reboot ging es

Esjay

Zitat von: SoeK am 17 Januar 2017, 21:34:33
@Esjay: Hast Du evtl. ein Leerzeichen im Namen eines der Favoriten? Dann hatte ich zumindest eine sehr ähnliche Fehlermeldung. Nach umbenennen von "1 Live" in "1Live" und Reboot ging es

Danke für deine Rückmeldung.Ich habe noch nichts mit den Favoriten gemacht,und bin mir auch noch nicht ganz sicher, wie das Attribut funktioniert. Ich habe die letzten 2 Tage darum gekämpft den Cromecast überhaupt einzubinden.
Ich vermute, dass ich per Attribut einen Link einem Favoriten zuordnen kann?!

SoeK

Schade dann hab' ich auch keine Idee :-( Favoriten: Genau, es gibt jeweils ein Attribut für die Url & Namen der 5 Favoriten

Esjay

Zitat von: SoeK am 17 Januar 2017, 21:42:57
Schade dann hab' ich auch keine Idee :-( Favoriten: Genau, es gibt jeweils ein Attribut für die Url & Namen der 5 Favoriten

Kein Thema.Danke für den Versuch zu helfen ;-)
Habe jetzt verbose vorrübergehend auf 0 gestellt,und gut ist.

Diektator

sudo cpanm --uninstall Inline::Python
sudo cpanm Inline::Python
sudo reboot

hat das Problem für mich gelöst, jetzt gehts ans Testen!  ;D