Skip to content

Commit

Permalink
#4 updated PyChromecast library
Browse files Browse the repository at this point in the history
  • Loading branch information
nohum authored Apr 5, 2017
1 parent 3bdadde commit 21ad605
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions handler/adapter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
from pychromecast import get_chromecast, ChromecastConnectionError, IDLE_APP_ID
from pychromecast import get_chromecasts, ChromecastConnectionError, IDLE_APP_ID
from pychromecast.controllers.media import MEDIA_PLAYER_STATE_IDLE
from pychromecast.socket_client import CONNECTION_STATUS_CONNECTED, CONNECTION_STATUS_FAILED, \
CONNECTION_STATUS_DISCONNECTED
Expand Down Expand Up @@ -223,7 +223,12 @@ def _worker(self):
def _internal_create_connection(self, ip_address):
try:
self.mqtt_properties.write_connection_status(CONNECTION_STATUS_WAITING_FOR_DEVICE)
self.device = get_chromecast(ip=ip_address, tries=15)
devices = get_chromecasts(tries=5) # TODO not the best way to do this, change with #3

for device in devices:
if device.host == ip_address:
self.device = device
break

if self.device is None:
self.logger.error("was not able to find chromecast %s" % self.ip_address)
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
paho-mqtt>=1.2,<1.30
PyChromecast==0.7.7
zeroconf>=0.17.6
PyChromecast>=0.8.0,<0.9.0
zeroconf>=0.17.7

0 comments on commit 21ad605

Please sign in to comment.