Skip to content

Commit

Permalink
Zeroconf workaround host not being an ipaddress
Browse files Browse the repository at this point in the history
  • Loading branch information
fondberg authored Jan 19, 2020
1 parent 99f42b2 commit 3de4587
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Community post: https://community.home-assistant.io/t/spotcast-custom-component-
_Now with support for speaker groups, transferring playback to and between chromecast devices and using HA entity id instead of device_name_.

***Important***
Release 2.6 has a dependency to zeroconf 0.24.3 to make HASS work until proper upstream fix exists.
Release 2.6.1 has a woraround for zeroconf 0.24.4 so it is no longer needed to use older version.

## Installation

Expand Down
9 changes: 7 additions & 2 deletions custom_components/spotcast/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import random
import time

_VERSION = '2.6.0'
_VERSION = '2.6.1'
DOMAIN = 'spotcast'

_LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -215,9 +215,14 @@ def getChromecastDevice(self, device_name):
known_devices = self.hass.data.get(KNOWN_CHROMECAST_INFO_KEY, [])
cast_info = next((x for x in known_devices if x.friendly_name == device_name), None)
_LOGGER.debug('cast info: %s', cast_info)
host = str(cast_info.host)

if host.startswith('record'):
host = cast_info.host.rpartition(',')[-1]

if cast_info:
return pychromecast._get_chromecast_from_host((
cast_info.host, cast_info.port, cast_info.uuid,
host, cast_info.port, cast_info.uuid,
cast_info.model_name, cast_info.friendly_name
))
_LOGGER.error('Could not find device %s from hass.data, falling back to pychromecast scan', device_name)
Expand Down

0 comments on commit 3de4587

Please sign in to comment.