[Altes Modul] GoogleCast (98_GOOGLECAST.pm)

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

Vorheriges Thema - Nächstes Thema

stetaba

Hallo dominik,

vielen Dank für die Weiterentwicklung. Leider habe ich mit der aktuellen Version große Probleme mit der Wiedergabe von Radiostreams. Die Wiedergabe funktioniert nur extrem selten (habe es 1-2 mal hingekriegt. Die Chromecast app auf meinem Handy zeigt zwar an das etwas gestreamt wird, es ist aber nichts zu hören. Habe nochmal auf die vorherigen Version gewechselt: Dort funktioniert die Wiedergabe problemlos.

Gruß Stephan

dominik

Hi Stephan,
kannst du mir die Radiostream URLs nennen mit welchen du Probleme hast?
Gruß
Dominik
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

LeoSum

#197
Hallo dominik,
erstmal danke für den Hinweis auf ldconfig. War aber leider bereits installiert.

Ich habe mittlerweile meine FHEM Installation auf ein neues System umgezogen und hatte die Hoffnung, dass sich als Nebeneffekt auch meine Chromacast-Modul-Probleme in Luft auflösen.

Hat sich leider nicht bewahrheitet.
Auch mit meinem neuen System bekomme ich einen ähnlichen fehler:

Wenn ich das Modul mit reload 98_CHROMECAST laden möchte, erhalte ich im Log folgendes:
Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "/usr/local/lib/python2.7/site-packages/pychromecast/__init__.py", line 12, in <module>
    from .config import *  # noqa
  File "/usr/local/lib/python2.7/site-packages/pychromecast/config.py", line 6, in <module>
    import requests
  File "/usr/local/lib/python2.7/site-packages/requests/__init__.py", line 100, in <module>
    from .api import request, get, head, post, patch, put, delete, options
  File "/usr/local/lib/python2.7/site-packages/requests/api.py", line 13, in <module>
    from . import sessions
  File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 41, in <module>
    if platform.system() == 'Windows':
  File "/usr/local/lib/python2.7/platform.py", line 1265, in system
    return uname()[0]
  File "/usr/local/lib/python2.7/platform.py", line 1232, in uname
    processor = _syscmd_uname('-p','')
  File "/usr/local/lib/python2.7/platform.py", line 967, in _syscmd_uname
    rc = f.close()
IOError: [Errno 10] No child processes


Wie auch bereits auf dem alten System funktioniert die manuelle Eingabe in der python console:


Da ich vermtutete, dass Inline Python bei mir nicht funktioniert, wollte ich das mit einem kleinen perl Script überprüfen, aber siehe da, auch das funktioniert:

#!/usr/bin/perl
use Inline Python => <<'PYTHON_CODE_END';

from __future__ import unicode_literals
import pychromecast
import time
import logging
import youtube_dl

def CHROMECAST_findChromecastsPython():
    logging.basicConfig(level=logging.CRITICAL)
    return pychromecast.discovery.discover_chromecasts()

PYTHON_CODE_END

my @ccResult = CHROMECAST_findChromecastsPython();
foreach my $ref_cc (@ccResult) {
    my @cc = @$ref_cc;                                                           
    $result .= "|CCDEVICE|".$cc[0]."|".$cc[1]."|".$cc[2]."|".$cc[3]."|".$cc[4];
}
print $result."\n";

Ergebnis:
root@fhem:/usr/home/fhemuser # perl testinline.pm
|CCDEVICE|192.168.178.211|8009|ad53ce14-da5f-bf31-0f02-b6a9f8f37fd2|Chromecast|CCK


Also zusammengefasst:
- pychromecast "pur" in python funktiert
- pychromecast per inline python in perl funktioniert
- CHROMECAST Modul funktioniert nicht

Wie kann das sein? Was läuft bei dem Aufruf aus dem Modul heraus anders als in meinem testscript?

EDIT:
Beim Versuch ein device anzulegen passiert im Log folgendes:
define CCK CHROMECAST CCK
Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "/usr/local/lib/python2.7/site-packages/pychromecast/__init__.py", line 12, in <module>
    from .config import *  # noqa
  File "/usr/local/lib/python2.7/site-packages/pychromecast/config.py", line 6, in <module>
    import requests
  File "/usr/local/lib/python2.7/site-packages/requests/__init__.py", line 97, in <module>
    from . import utils
ImportError: cannot import name utils
2017.07.22 18:02:47 1: reload: Error:Modul 98_CHROMECAST deactivated:
Error -- py_eval raised an exception at /usr/local/lib/perl5/site_perl/mach/5.24/Inline/Python.pm line 177.
BEGIN failed--compilation aborted at ./FHEM/98_CHROMECAST.pm line 531.

2017.07.22 18:02:47 0: Error -- py_eval raised an exception at /usr/local/lib/perl5/site_perl/mach/5.24/Inline/Python.pm line 177.
BEGIN failed--compilation aborted at ./FHEM/98_CHROMECAST.pm line 531.

dominik

#198
ZitatImportError: cannot import name utils

Liegt es vielleicht daran? "utils" für Python?
Probier auch dein Testscript mit dem fhem User auszuführen. Vielleicht hat es damit was zu tun.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

LeoSum

ich komme einfach nicht dahinter.
Ich umgehe das Problem jetzt durch einen system Aufruf aus FHEM heraus:
{system("/usr/local/bin/python /usr/home/fhemuser/cast_infoscreen.py&")}

stetaba


b4r7

Hallo Dominik,

Vielen Dank für das Modul!

Eine Bitte bzw. einen Verbesserungsvorschlag hätte ich:

Ein Reading das mir einfach und simpel sagt "streaming" wenn gerade irgendetwas gestreamt wird.
Hintergrund ich will so einfach wie möglich eine Steckdose schalten um die Boxen anzuwerfen wenn ich etwas aufm Smartphone auswähle.
FHEM auf Debian VM (FreeNAS bhyve)
HMUart + ZME-UZB1 über RPi2/ser2net

siggi85

Hey,

danke für die Weiterentwicklung!!! Habe das neue Modul gestern installiert und meinen Wohnzimmer Chromcast wieder definiert und bisher funktioniert FHEM noch. Sieht also gut aus.
Einfach herlich wieder über meine Harmony "Play", "Pause" und "Stop" für den Chromecast nutzen zu können.   :D

Gruß
Siggi

stetaba

Hi,

Ich habe nochmal mein device entfernt und neu angelegt. Jetzt funktioniert alles. Perfekt !
Vielleicht gab es noch Probleme beim Update und Übernahme der readings.

Dersch

Ich scheitere leider schon bei der Installation von pychromecast :(


sudo pip install pychromecast
Downloading/unpacking pychromecast
  Downloading PyChromecast-0.8.2.tar.gz
  Running setup.py egg_info for package pychromecast

    warning: no previously-included files matching '*.py[co]' found under directory '*'
Downloading/unpacking requests>=2.0 (from pychromecast)
  Downloading requests-2.18.2.tar.gz (125Kb): 125Kb downloaded
  Running setup.py egg_info for package requests

    warning: no files found matching 'NOTICE'
Downloading/unpacking protobuf>=3.0.0 (from pychromecast)
  Downloading protobuf-3.3.0.tar.gz (271Kb): 271Kb downloaded
  Running setup.py egg_info for package protobuf

    no previously-included directories found matching 'google/protobuf/internal/import_test_package'
    warning: no previously-included files found matching 'google/protobuf/internal/*_pb2.py'
    warning: no previously-included files found matching 'google/protobuf/internal/*_test.py'
    warning: no previously-included files found matching 'google/protobuf/internal/*.proto'
    warning: no previously-included files found matching 'google/protobuf/internal/test_util.py'
    warning: no previously-included files matching '*_test.py' found under directory 'google'
    warning: no previously-included files matching '*_test.proto' found under directory 'google'
    warning: no previously-included files matching 'unittest*_pb2.py' found under directory 'google'
    warning: no previously-included files matching '*.dll' found anywhere in distribution
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no previously-included files matching '*.pyo' found anywhere in distribution
    warning: no previously-included files matching '*.so' found anywhere in distribution
Downloading/unpacking zeroconf>=0.17.7 (from pychromecast)
  Downloading zeroconf-0.19.1.tar.gz
  Running setup.py egg_info for package zeroconf

Downloading/unpacking six>=1.10.0 (from pychromecast)
  Downloading six-1.10.0.tar.gz
  Running setup.py egg_info for package six

    no previously-included directories found matching 'documentation/_build'
Downloading/unpacking chardet>=3.0.2,<3.1.0 (from requests>=2.0->pychromecast)
  Downloading chardet-3.0.4.tar.gz (1.9Mb): 1.9Mb downloaded
  Running setup.py egg_info for package chardet

    warning: no files found matching 'requirements.txt'
Downloading/unpacking idna>=2.5,<2.6 (from requests>=2.0->pychromecast)
  Downloading idna-2.5.tar.gz (130Kb): 130Kb downloaded
  Running setup.py egg_info for package idna

    warning: no previously-included files matching '*.pyc' found under directory 'tools'
    warning: no previously-included files matching '*.pyc' found under directory 'tests'
Downloading/unpacking urllib3>=1.21.1,<1.23 (from requests>=2.0->pychromecast)
  Downloading urllib3-1.22.tar.gz (226Kb): 226Kb downloaded
  Running setup.py egg_info for package urllib3

    warning: no previously-included files matching '*' found under directory 'docs/_build'
Downloading/unpacking certifi>=2017.4.17 (from requests>=2.0->pychromecast)
  Downloading certifi-2017.7.27.1.tar.gz (348Kb): 348Kb downloaded
  Running setup.py egg_info for package certifi

Requirement already satisfied (use --upgrade to upgrade): distribute in /usr/lib/python2.7/dist-packages (from protobuf>=3.0.0->pychromecast)
Downloading/unpacking enum-compat (from zeroconf>=0.17.7->pychromecast)
  Downloading enum-compat-0.0.2.tar.gz
  Running setup.py egg_info for package enum-compat

Downloading/unpacking netifaces!=0.10.5 (from zeroconf>=0.17.7->pychromecast)
  Downloading netifaces-0.10.6.tar.gz
  Running setup.py egg_info for package netifaces

Downloading/unpacking enum34 (from enum-compat->zeroconf>=0.17.7->pychromecast)
  Downloading enum34-1.1.6.tar.gz (40Kb): 40Kb downloaded
  Running setup.py egg_info for package enum34

Installing collected packages: pychromecast, requests, protobuf, zeroconf, six, chardet, idna, urllib3, certifi, enum-compat, netifaces, enum34
  Running setup.py install for pychromecast

    warning: no previously-included files matching '*.py[co]' found under directory '*'
  Running setup.py install for requests

    warning: no files found matching 'NOTICE'
  Running setup.py install for protobuf
    Skipping installation of /usr/local/lib/python2.7/dist-packages/google/__init__.py (namespace package)

    no previously-included directories found matching 'google/protobuf/internal/import_test_package'
    warning: no previously-included files found matching 'google/protobuf/internal/*_pb2.py'
    warning: no previously-included files found matching 'google/protobuf/internal/*_test.py'
    warning: no previously-included files found matching 'google/protobuf/internal/*.proto'
    warning: no previously-included files found matching 'google/protobuf/internal/test_util.py'
    warning: no previously-included files matching '*_test.py' found under directory 'google'
    warning: no previously-included files matching '*_test.proto' found under directory 'google'
    warning: no previously-included files matching 'unittest*_pb2.py' found under directory 'google'
    warning: no previously-included files matching '*.dll' found anywhere in distribution
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no previously-included files matching '*.pyo' found anywhere in distribution
    warning: no previously-included files matching '*.so' found anywhere in distribution
    Installing /usr/local/lib/python2.7/dist-packages/protobuf-3.3.0-nspkg.pth
  Running setup.py install for zeroconf

  Running setup.py install for six

    no previously-included directories found matching 'documentation/_build'
  Running setup.py install for chardet

    warning: no files found matching 'requirements.txt'
    Installing chardetect script to /usr/local/bin
  Running setup.py install for idna

    warning: no previously-included files matching '*.pyc' found under directory 'tools'
    warning: no previously-included files matching '*.pyc' found under directory 'tests'
  Running setup.py install for urllib3

    warning: no previously-included files matching '*' found under directory 'docs/_build'
  Running setup.py install for certifi

  Running setup.py install for enum-compat

  Running setup.py install for netifaces
    checking for getifaddrs...found.
    checking for getnameinfo...found.
    checking for IPv6 socket IOCTLs...not found.
    checking for optional header files...netash/ash.h netatalk/at.h netax25/ax25.h neteconet/ec.h netipx/ipx.h netpacket/packet.h linux/irda.h linux/atm.h linux/llc.h linux/tipc.h linux/dn.h.
    checking whether struct sockaddr has a length field...no.
    checking which sockaddr_xxx structs are defined...at ax25 in in6 ipx un ash ec ll atmpvc atmsvc dn irda llc.
    checking for routing socket support...no.
    checking for sysctl(CTL_NET...) support...no.
    checking for netlink support...yes.
    will use netlink to read routing table
    building 'netifaces' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DNETIFACES_VERSION=0.10.6 -DHAVE_GETIFADDRS=1 -DHAVE_GETNAMEINFO=1 -DHAVE_NETASH_ASH_H=1 -DHAVE_NETATALK_AT_H=1 -DHAVE_NETAX25_AX25_H=1 -DHAVE_NETECONET_EC_H=1 -DHAVE_NETIPX_IPX_H=1 -DHAVE_NETPACKET_PACKET_H=1 -DHAVE_LINUX_IRDA_H=1 -DHAVE_LINUX_ATM_H=1 -DHAVE_LINUX_LLC_H=1 -DHAVE_LINUX_TIPC_H=1 -DHAVE_LINUX_DN_H=1 -DHAVE_SOCKADDR_AT=1 -DHAVE_SOCKADDR_AX25=1 -DHAVE_SOCKADDR_IN=1 -DHAVE_SOCKADDR_IN6=1 -DHAVE_SOCKADDR_IPX=1 -DHAVE_SOCKADDR_UN=1 -DHAVE_SOCKADDR_ASH=1 -DHAVE_SOCKADDR_EC=1 -DHAVE_SOCKADDR_LL=1 -DHAVE_SOCKADDR_ATMPVC=1 -DHAVE_SOCKADDR_ATMSVC=1 -DHAVE_SOCKADDR_DN=1 -DHAVE_SOCKADDR_IRDA=1 -DHAVE_SOCKADDR_LLC=1 -DHAVE_PF_NETLINK=1 -I/usr/include/python2.7 -c netifaces.c -o build/temp.linux-armv7l-2.7/netifaces.o
    netifaces.c:1:20: fatal error: Python.h: No such file or directory
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    Complete output from command /usr/bin/python -c "import setuptools;__file__='/home/pi/build/netifaces/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-L2coqa-record/install-record.txt:
    running install

running build

running build_ext

checking for getifaddrs...found.

checking for getnameinfo...found.

checking for IPv6 socket IOCTLs...not found.

checking for optional header files...netash/ash.h netatalk/at.h netax25/ax25.h neteconet/ec.h netipx/ipx.h netpacket/packet.h linux/irda.h linux/atm.h linux/llc.h linux/tipc.h linux/dn.h.

checking whether struct sockaddr has a length field...no.

checking which sockaddr_xxx structs are defined...at ax25 in in6 ipx un ash ec ll atmpvc atmsvc dn irda llc.

checking for routing socket support...no.

checking for sysctl(CTL_NET...) support...no.

checking for netlink support...yes.

will use netlink to read routing table

building 'netifaces' extension

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DNETIFACES_VERSION=0.10.6 -DHAVE_GETIFADDRS=1 -DHAVE_GETNAMEINFO=1 -DHAVE_NETASH_ASH_H=1 -DHAVE_NETATALK_AT_H=1 -DHAVE_NETAX25_AX25_H=1 -DHAVE_NETECONET_EC_H=1 -DHAVE_NETIPX_IPX_H=1 -DHAVE_NETPACKET_PACKET_H=1 -DHAVE_LINUX_IRDA_H=1 -DHAVE_LINUX_ATM_H=1 -DHAVE_LINUX_LLC_H=1 -DHAVE_LINUX_TIPC_H=1 -DHAVE_LINUX_DN_H=1 -DHAVE_SOCKADDR_AT=1 -DHAVE_SOCKADDR_AX25=1 -DHAVE_SOCKADDR_IN=1 -DHAVE_SOCKADDR_IN6=1 -DHAVE_SOCKADDR_IPX=1 -DHAVE_SOCKADDR_UN=1 -DHAVE_SOCKADDR_ASH=1 -DHAVE_SOCKADDR_EC=1 -DHAVE_SOCKADDR_LL=1 -DHAVE_SOCKADDR_ATMPVC=1 -DHAVE_SOCKADDR_ATMSVC=1 -DHAVE_SOCKADDR_DN=1 -DHAVE_SOCKADDR_IRDA=1 -DHAVE_SOCKADDR_LLC=1 -DHAVE_PF_NETLINK=1 -I/usr/include/python2.7 -c netifaces.c -o build/temp.linux-armv7l-2.7/netifaces.o

netifaces.c:1:20: fatal error: Python.h: No such file or directory

compilation terminated.

error: command 'gcc' failed with exit status 1

----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/home/pi/build/netifaces/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-L2coqa-record/install-record.txt failed with error code 1 in /home/pi/build/netifaces
Storing complete log in /root/.pip/pip.log



dominik

Probier mal "pip" zu aktualisieren, vielleicht liegt es daran?

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

Dersch

Das habe ich davor frisch installiert. Das youtube ging auch normal durch.

cramu

Zitat von: dominik am 10 Dezember 2015, 22:43:49
sudo apt-get install libwww-perl python-
sudo pip install pychromecast
sudo pip install youtube-dl
sudo cpanm Inline::Python


Kann mir jemand erklären, wie ich cpanminus unter Raspbian installiere?
Daran scheitert die Installation des Moduls bei mir.

mahowi

Zitat von: cramu am 08 August 2017, 21:23:52
Kann mir jemand erklären, wie ich cpanminus unter Raspbian installiere?
Daran scheitert die Installation des Moduls bei mir.

Wie wäre es mit sudo apt-get install cpanminus
;)
CUBe (MAX): HT, FK | CUBe (SlowRF): ESA2000WZ
JeeLink: LaCrosse | nanoCUL433: Smartwares SHS-51001-EU, EM1000GZ
ZME_UZB1: GreenWave PowerNode, Popp Thermostat | SIGNALDuino: HE877, X10 MS14A, Revolt NC-5462,  IT Steckdosen + PIR
tado° | Milight | HUE, Lightify | SmarterCoffee

cramu

Vielen Dank, jetzt läufts (übrigens über einen Google Home, dieser wird in den Readings auch als solcher ausgewiesen)!
Auf meinem jungfräulichen Raspbian war außerdem noch die Installation weiterer Pakete vonnöten.