2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-07 19:04:20 +00:00

98_GOOGLECAST: support pychromecast 5.1

git-svn-id: https://svn.fhem.de/fhem/trunk@21905 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
dominikkarall 2020-05-09 17:35:38 +00:00
parent a46883c983
commit 9b0a9633ae

View File

@ -1,16 +1,19 @@
############################################################# #############################################################
# #
# GOOGLECAST.pm (c) by Dominik Karall, 2016-2018 # GOOGLECAST.pm (c) by Dominik Karall, 2016-2020
# dominik karall at gmail dot com # dominik karall at gmail dot com
# $Id$ # $Id$
# #
# 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.4 # Version: 2.1.5
# #
############################################################# #############################################################
# #
# v2.1.5 - 20200509
# - BUGFIX: support pychromecast 5.1
#
# v2.1.4 - 20190403 # v2.1.4 - 20190403
# - BUGFIX: support pychromecast 3.x # - BUGFIX: support pychromecast 3.x
# #
@ -222,6 +225,7 @@ sub GOOGLECAST_findChromecastsResult {
}; };
if($@) { if($@) {
$hash->{helper}{ccdevice} = ""; $hash->{helper}{ccdevice} = "";
Log3 $hash, 1, "GOOGLECAST Error ($hash->{NAME}): $@";
} }
Log3 $hash, 4, "GOOGLECAST ($hash->{NAME}): device initialized"; Log3 $hash, 4, "GOOGLECAST ($hash->{NAME}): device initialized";
} }
@ -712,7 +716,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) try:
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)
except:
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")), timeout=0.1, tries=1, retry_wait=0.1)
try: try:
cast.connect() cast.connect()
except: except: