Skip to content

Commit

Permalink
Change unsupported media warning
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Feb 23, 2021
1 parent 42bd1be commit 3027928
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions custom_components/yandex_station/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ async def async_turn_off(self):
async def update(self, data: dict = None):
"""Обновления только в локальном режиме."""
if data is None:
# возвращаем в облачный режим
_LOGGER.debug("Возврат в облачный режим")
self.local_state = None
self.async_write_ha_state()
return
Expand Down Expand Up @@ -627,7 +627,7 @@ async def async_play_media(self, media_type: str, media_id: str, **kwargs):
return

else:
_LOGGER.warning(f"Unsupported media: {media_id}")
_LOGGER.warning(f"Unsupported local media: {media_id}")
return

await self.glagol.send(payload)
Expand All @@ -646,24 +646,41 @@ async def async_play_media(self, media_type: str, media_id: str, **kwargs):
return

else:
_LOGGER.warning(f"Unsupported media: {media_type}")
_LOGGER.warning(f"Unsupported cloud media: {media_type}")
return


# noinspection PyAbstractClass
class YandexIntents(MediaPlayerEntity):
def __init__(self, intents: list):
self.intents = intents
def __init__(self, unique_id: str):
self._unique_id = unique_id

@property
def unique_id(self):
return self._unique_id

@property
def name(self):
return "Yandex Intents"
return "Яндекс Сценарии"

@property
def state(self):
return 'off'

@property
def supported_features(self):
return (SUPPORT_TURN_ON | SUPPORT_TURN_OFF | SUPPORT_VOLUME_SET |
SUPPORT_VOLUME_STEP)

@property
def device_info(self):
return {
'identifiers': {(DOMAIN, self._unique_id)},
'manufacturer': "Яндекс",
'model': "Quasar",
'name': self.name,
}

async def async_volume_up(self):
pass

Expand Down

1 comment on commit 3027928

@snkku
Copy link

@snkku snkku commented on 3027928 Feb 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

круто, только вот
add_entities([YandexIntents(intents)])
а дальше вместо старого
def init(self, intents: list):
новое
def init(self, unique_id: str):

отсюда ошибка, что list это не str... и unique_id брать неоткуда

Please sign in to comment.