Skip to content

Commit

Permalink
Merge pull request #314 from custom-components/dev
Browse files Browse the repository at this point in the history
2.0.1
  • Loading branch information
alandtse authored Aug 31, 2019
2 parents 474c30d + f455772 commit e102848
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 31 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[Alexa Media Player Custom Component](https://github.com/keatontaylor/alexa_media_player) for homeassistant
[Alexa Media Player Custom Component](https://github.com/custom-components/alexa_media_player) for homeassistant

# What This Is:
This is a custom component to allow control of Amazon Alexa devices in [Homeassistant](https://home-assistant.io) using the unofficial Alexa API. Please note this mimics the Alexa app but Amazon may cut off access at anytime.
Expand All @@ -16,15 +16,15 @@ Allows for control of Amazon Echo products as home assistant media devices with
* Album Image

# Installation and Configuration
Please see the [wiki.](https://github.com/keatontaylor/alexa_media_player/wiki/Installation-and-Configuration)
Please see the [wiki.](https://github.com/custom-components/alexa_media_player/wiki/Installation-and-Configuration)

# Notable Additional Features
## Play Music
We can basically do anything a Alexa [Routine](https://www.amazon.com/gp/help/customer/display.html?nodeId=G202200080) can do. You'll have to [discover specifics](https://github.com/keatontaylor/alexa_media_player/wiki/Sequence-Discovery), but here are some examples (and please help add them below!).
We can basically do anything a Alexa [Routine](https://www.amazon.com/gp/help/customer/display.html?nodeId=G202200080) can do. You'll have to [discover specifics](https://github.com/custom-components/alexa_media_player/wiki/Sequence-Discovery), but here are some examples (and please help add them below!).
To play music using the `media_player.play_media` service, you have to define the media_content_type appropriately. Search the [forum](https://community.home-assistant.io/t/echo-devices-alexa-as-media-player-testers-needed/58639/2055) for other examples.

## Notification service (versions >= 1.2.0)
Please see [Notification Component](https://github.com/keatontaylor/alexa_media_player/wiki/Notification-Component) for TTS, announcements, or mobile push.
Please see [Notification Component](https://github.com/custom-components/alexa_media_player/wiki/Notification-Component) for TTS, announcements, or mobile push.
**Please note we do not support the the Media Player UI for TTS!**

## Online status of devices
Expand Down Expand Up @@ -63,21 +63,21 @@ We also support [HACS](https://custom-components.github.io/hacs/). **This cannot
In order to find Alexa Media Player, you first need to add the repository:
1. Open HACS
2. Go to Settings
3. Enter `https://github.com/keatontaylor/alexa_media_player`in **ADD CUSTOM REPOSITORY**. Select type `integration`.
3. Enter `https://github.com/custom-components/alexa_media_player`in **ADD CUSTOM REPOSITORY**. Select type `integration`.

## Guard Mode (versions >= 1.3.0)
Arm and disarm Alexa guard mode using an Alarm Control Panel. To arm, use `ARM_AWAY`. `ARM_HOME` is the same as `DISARM`. Please ensure you've enabled through the [Alexa app](https://www.amazon.com/b?ie=UTF8&node=18021383011).

We do not support any Guard notifications at the moment.

## Notification service (versions >= 1.2.0)
Please see [Notification Component](https://github.com/keatontaylor/alexa_media_player/wiki/Notification-Component).
Please see [Notification Component](https://github.com/custom-components/alexa_media_player/wiki/Notification-Component).

# Further Documentation
Please see the [wiki](https://github.com/keatontaylor/alexa_media_player/wiki)
Please see the [wiki](https://github.com/custom-components/alexa_media_player/wiki)

# Changelog
Use the commit history but we try to maintain this [wiki](https://github.com/keatontaylor/alexa_media_player/wiki/Changelog).
Use the commit history but we try to maintain this [wiki](https://github.com/custom-components/alexa_media_player/wiki/Changelog).

# License
[Apache-2.0](LICENSE). By providing a contribution, you agree the contribution is licensed under Apache-2.0. This is required for Home Assistant contributions.
26 changes: 15 additions & 11 deletions custom_components/alexa_media/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ async def setup_platform_callback(hass, config, login, callback_data):
callback_data (json): Returned data from configurator passed through
request_configuration and configuration_callback
"""
_LOGGER.debug(("Status: %s got captcha: %s securitycode: %s"
_LOGGER.debug(("Configurator closed for Status: %s\n"
" got captcha: %s securitycode: %s"
" Claimsoption: %s AuthSelectOption: %s "
" VerificationCode: %s"),
login.status,
Expand Down Expand Up @@ -196,7 +197,7 @@ async def configuration_callback(callback_data):
"Alexa Media Player - Verification Method - {}".format(email),
configuration_callback,
description=('Please select the verification method. '
'(e.g., sms or email).\n{}'.format(options)
'(e.g., `sms` or `email`).\n{}'.format(options)
# + links
+ footer),
submit_caption="Confirm",
Expand All @@ -212,7 +213,7 @@ async def configuration_callback(callback_data):
"Alexa Media Player - OTP Method - {}".format(email),
configuration_callback,
description=('Please select the OTP method. '
'(e.g., 0, 1).<br />{}'.format(options)
'(e.g., `0`, `1`).<br />{}'.format(options)
# + links
+ footer),
submit_caption="Confirm",
Expand Down Expand Up @@ -462,10 +463,12 @@ async def update_bluetooth_state(login_obj, device_serial):
['media_player']
[device_serial])

for b_state in bluetooth['bluetoothStates']:
if device_serial == b_state['deviceSerialNumber']:
device['bluetooth_state'] = b_state
return device['bluetooth_state']
if 'bluetoothStates' in bluetooth:
for b_state in bluetooth['bluetoothStates']:
if device_serial == b_state['deviceSerialNumber']:
device['bluetooth_state'] = b_state
return device['bluetooth_state']
return None

async def last_call_handler(call):
"""Handle last call service request.
Expand Down Expand Up @@ -588,10 +591,11 @@ async def ws_handler(message_obj):
json_payload)
bluetooth_state = await update_bluetooth_state(login_obj,
serial)
hass.bus.async_fire(
('{}_{}'.format(DOMAIN,
hide_email(email)))[0:32],
{'bluetooth_change': bluetooth_state})
if bluetooth_state:
hass.bus.async_fire(
('{}_{}'.format(DOMAIN,
hide_email(email)))[0:32],
{'bluetooth_change': bluetooth_state})
elif command == 'PUSH_MEDIA_QUEUE_CHANGE':
# Player availability update
serial = (json_payload['dopplerId']['deviceSerialNumber'])
Expand Down
4 changes: 2 additions & 2 deletions custom_components/alexa_media/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"""
from datetime import timedelta

__version__ = '2.0.0'
PROJECT_URL = "https://github.com/keatontaylor/alexa_media_player/"
__version__ = '2.0.1'
PROJECT_URL = "https://github.com/custom-components/alexa_media_player/"
ISSUE_URL = "{}issues".format(PROJECT_URL)

DOMAIN = 'alexa_media'
Expand Down
5 changes: 3 additions & 2 deletions custom_components/alexa_media/manifest.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"domain": "alexa_media",
"name": "Alexa Media Player",
"documentation": "https://github.com/keatontaylor/alexa_media_player/wiki",
"documentation": "https://github.com/custom-components/alexa_media_player/wiki",
"dependencies": [],
"codeowners": ["@keatontaylor", "@alandtse"],
"requirements": ["alexapy==1.0.0"]
"requirements": ["alexapy==1.0.1"],
"homeassistant": "0.96.0"
}
6 changes: 3 additions & 3 deletions custom_components/alexa_media/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,10 @@ async def _handle_event(self, event):
if (event.data['bluetooth_change']['deviceSerialNumber'] ==
self.device_serial_number):
self._bluetooth_state = event.data['bluetooth_change']
self._source = self._get_source()
self._source_list = self._get_source_list()
self._source = await self._get_source()
self._source_list = await self._get_source_list()
if (self.hass and self.async_schedule_update_ha_state):
await self.async_schedule_update_ha_state()
self.async_schedule_update_ha_state()
elif 'player_state' in event.data:
player_state = event.data['player_state']
if (player_state['dopplerId']
Expand Down
10 changes: 5 additions & 5 deletions info.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[Alexa Media Player Custom Component](https://github.com/keatontaylor/alexa_media_player) for homeassistant
[Alexa Media Player Custom Component](https://github.com/custom-components/alexa_media_player) for homeassistant

This is a custom component to allow control of Amazon Alexa devices in [Homeassistant](https://home-assistant.io) using the unofficial Alexa API. Please note this mimics the Alexa app but Amazon may cut off access at anytime.

Expand All @@ -10,8 +10,8 @@ This is a custom component to allow control of Amazon Alexa devices in [Homeassi

## Useful links

- [General documentation](https://github.com/keatontaylor/alexa_media_player/wiki)
- [Installation and Configuration](https://github.com/keatontaylor/alexa_media_player/wiki/Installation-and-Configuration)
- [FAQ](https://github.com/keatontaylor/alexa_media_player/wiki/FAQ)
- [Repository](https://github.com/keatontaylor/alexa_media_player)
- [General documentation](https://github.com/custom-components/alexa_media_player/wiki)
- [Installation and Configuration](https://github.com/custom-components/alexa_media_player/wiki/Installation-and-Configuration)
- [FAQ](https://github.com/custom-components/alexa_media_player/wiki/FAQ)
- [Repository](https://github.com/custom-components/alexa_media_player)
- [Forum post](https://community.home-assistant.io/t/echo-devices-alexa-as-media-player-testers-needed/58639)

0 comments on commit e102848

Please sign in to comment.