mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
98_GOOGLECAST: support pychromecast 3.x
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@19107 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
c53087513f
commit
247476a973
@ -7,10 +7,13 @@
|
|||||||
# FHEM module to communicate with Google Cast devices
|
# FHEM module to communicate with Google Cast devices
|
||||||
# e.g. Chromecast Video, Chromecast Audio, Google Home
|
# e.g. Chromecast Video, Chromecast Audio, Google Home
|
||||||
#
|
#
|
||||||
# Version: 2.1.3
|
# Version: 2.1.4
|
||||||
#
|
#
|
||||||
#############################################################
|
#############################################################
|
||||||
#
|
#
|
||||||
|
# v2.1.4 - 20190403
|
||||||
|
# - BUGFIX: support pychromecast 3.x
|
||||||
|
#
|
||||||
# v2.1.3 - 20180311
|
# v2.1.3 - 20180311
|
||||||
# - BUGFIX: fix umlauts for device name readings
|
# - BUGFIX: fix umlauts for device name readings
|
||||||
#
|
#
|
||||||
@ -153,7 +156,7 @@ sub GOOGLECAST_Initialize($) {
|
|||||||
$hash->{AttrList} = "favoriteURL_1 favoriteURL_2 favoriteURL_3 favoriteURL_4 ".
|
$hash->{AttrList} = "favoriteURL_1 favoriteURL_2 favoriteURL_3 favoriteURL_4 ".
|
||||||
"favoriteURL_5 ".$readingFnAttributes;
|
"favoriteURL_5 ".$readingFnAttributes;
|
||||||
|
|
||||||
Log3 $hash, 3, "GOOGLECAST: GoogleCast v2.1.3";
|
Log3 $hash, 3, "GOOGLECAST: GoogleCast v2.1.4";
|
||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
@ -569,12 +572,15 @@ sub GOOGLECAST_addSocketToMainloop {
|
|||||||
#delete any previous sockets
|
#delete any previous sockets
|
||||||
delete($selectlist{"GOOGLECAST-".$hash->{NAME}});
|
delete($selectlist{"GOOGLECAST-".$hash->{NAME}});
|
||||||
|
|
||||||
eval {
|
my $result = eval {
|
||||||
$sock = $hash->{helper}{ccdevice}->{socket_client}->get_socket();
|
$sock = $hash->{helper}{ccdevice}->{socket_client}->get_socket();
|
||||||
if ($sock->fileno() > 0) {
|
if ($sock->fileno() > 0) {
|
||||||
$hash->{helper}{currentsock} = $sock;
|
$hash->{helper}{currentsock} = $sock;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
unless($result) {
|
||||||
|
print $@;
|
||||||
|
}
|
||||||
|
|
||||||
if ($sock->fileno() > 0) {
|
if ($sock->fileno() > 0) {
|
||||||
my $chash = GOOGLECAST_newChash($hash, $sock, {NAME => "GOOGLECAST-".$hash->{NAME}});
|
my $chash = GOOGLECAST_newChash($hash, $sock, {NAME => "GOOGLECAST-".$hash->{NAME}});
|
||||||
@ -709,6 +715,10 @@ def GOOGLECAST_PyFindChromecasts():
|
|||||||
def GOOGLECAST_PyCreateChromecast(ip, port, uuid, model_name, friendly_name):
|
def GOOGLECAST_PyCreateChromecast(ip, port, uuid, model_name, friendly_name):
|
||||||
logging.basicConfig(level=logging.CRITICAL)
|
logging.basicConfig(level=logging.CRITICAL)
|
||||||
cast = pychromecast._get_chromecast_from_host((ip.decode("utf-8"), int(port), uuid.decode("utf-8"), model_name.decode("utf-8"), friendly_name.decode("utf-8")), blocking=False, timeout=0.1, tries=1, retry_wait=0.1)
|
cast = pychromecast._get_chromecast_from_host((ip.decode("utf-8"), int(port), uuid.decode("utf-8"), model_name.decode("utf-8"), friendly_name.decode("utf-8")), blocking=False, timeout=0.1, tries=1, retry_wait=0.1)
|
||||||
|
try:
|
||||||
|
cast.connect()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
return cast
|
return cast
|
||||||
|
|
||||||
def GOOGLECAST_PyPlayMedia(cast, url, mime):
|
def GOOGLECAST_PyPlayMedia(cast, url, mime):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user