Skip to content

Commit

Permalink
Update to 1.2.1 (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
alandtse authored Mar 13, 2019
2 parents 4b9701f + 282bf91 commit 8dbd8f5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion alexa_media/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

REQUIREMENTS = ['alexapy==0.3.0']

__version__ = '1.2.0'
__version__ = '1.2.1'

_LOGGER = logging.getLogger(__name__)

Expand Down
20 changes: 12 additions & 8 deletions alexa_media/notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ def convert(self, names, type_="entities", filter_matches=False):
for item in names:
matched = False
for alexa in self.devices:
_LOGGER.debug("Testing item: %s against (%s, %s, %s)",
_LOGGER.debug("Testing item: %s against (%s, %s, %s, %s)",
item,
alexa,
alexa.name,
alexa.unique_id,
hide_serial(alexa.unique_id),
alexa.entity_id)
if item in (alexa, alexa.name, alexa.unique_id,
alexa.entity_id):
Expand All @@ -87,9 +88,6 @@ def convert(self, names, type_="entities", filter_matches=False):
item,
type_,
converted)
else:
_LOGGER.debug("Filtering out: %s",
item)
if not filter_matches and not matched:
devices.append(item)
return devices
Expand Down Expand Up @@ -139,8 +137,11 @@ def send_message(self, message="", **kwargs):
if isinstance(targets, str):
targets = [targets]
entities = self.convert(targets, type_="entities")
entities.extend(self.hass.components.group.expand_entity_ids(entities))

try:
entities.extend(self.hass.components.group.expand_entity_ids(
entities))
except ValueError:
_LOGGER.info("Invalid Home Assistant entity in %s", entities)
if data['type'] == "tts":
targets = self.convert(entities, type_="entities",
filter_matches=True)
Expand All @@ -151,11 +152,14 @@ def send_message(self, message="", **kwargs):
elif data['type'] == "announce":
targets = self.convert(entities, type_="serialnumbers",
filter_matches=True)
_LOGGER.debug("Announce targets: %s entities: %s",
list(map(hide_serial, targets)),
entities)
for account, account_dict in (self.hass.data[DATA_ALEXAMEDIA]
['accounts'].items()):
for alexa in (account_dict['entities']
['media_player'].values()):
if alexa in entities and alexa.available:
if alexa.unique_id in targets and alexa.available:
_LOGGER.info(("%s: Announce by %s to "
"targets: %s: %s"),
hide_email(account),
Expand Down
2 changes: 1 addition & 1 deletion custom_components.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"alexa_media": {
"version": "1.2.0",
"version": "1.2.1",
"local_location": "/custom_components/alexa_media/__init__.py",
"remote_location": "https://raw.githubusercontent.com/keatontaylor/alexa_media_player/master/alexa_media/__init__.py",
"visit_repo": "https://github.com/keatontaylor/alexa_media_player",
Expand Down

0 comments on commit 8dbd8f5

Please sign in to comment.