Skip to content

Commit

Permalink
Merge pull request #329 from alandtse/#328
Browse files Browse the repository at this point in the history
fix(notify): add key check for targets
  • Loading branch information
alandtse committed Sep 3, 2019
2 parents 4c74ffa + 6f4a050 commit 06041bb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions custom_components/alexa_media/notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,16 @@ def targets(self):
devices = {}
for account, account_dict in (self.hass.data[DATA_ALEXAMEDIA]
['accounts'].items()):
if ('devices' not in account_dict):
return devices
for serial, alexa in (account_dict
['devices']['media_player'].items()):
devices[alexa['accountName']] = serial
return devices

@property
def devices(self):
"""Return a dictionary of Alexa devices."""
"""Return a list of Alexa devices."""
devices = []
if ('accounts' not in self.hass.data[DATA_ALEXAMEDIA] and
not self.hass.data[DATA_ALEXAMEDIA]['accounts'].items()):
Expand All @@ -116,7 +118,7 @@ def devices(self):
['entities']['media_player'].values())
return devices

async def send_message(self, message="", **kwargs):
async def async_send_message(self, message="", **kwargs):
"""Send a message to a Alexa device."""
_LOGGER.debug("Message: %s, kwargs: %s",
message,
Expand Down

0 comments on commit 06041bb

Please sign in to comment.