Skip to content

Instantly share code, notes, and snippets.

@AlexxIT
Created August 6, 2020 04:42
Show Gist options
  • Save AlexxIT/0ba110a4e1214eeac21d2f942f28a1d7 to your computer and use it in GitHub Desktop.
Save AlexxIT/0ba110a4e1214eeac21d2f942f28a1d7 to your computer and use it in GitHub Desktop.
TTS на колонках с Алисой из командной строки
import asyncio
import sys
from os import path
from aiohttp import ClientSession
from custom_components.yandex_station.yandex_quasar import YandexQuasar
async def main(cachefile: str, text: str):
async with ClientSession() as session:
quasar = YandexQuasar(session)
speakers = await quasar.init('myuser', 'mypass', cachefile)
for speaker in speakers:
if speaker['name'] == 'Яндекс Мини':
await quasar.send(speaker, text, is_tts=True)
if __name__ == '__main__':
text = ' '.join(sys.argv[1:])
cachefile = path.join(path.dirname(path.abspath(__file__)),
'.yandex_station.json')
asyncio.run(main(cachefile, text))
@AlexxIT
Copy link
Author

AlexxIT commented Feb 1, 2021

Думаю, можно пользоваться со второй версией компонента. В третей версии сильно поменялась авторизация. Этот пример работать не будет

@vahotm
Copy link

vahotm commented Mar 8, 2021

Я прошу прощения - этот скрипт надо выполнять только из системы HomeAssistant?

@BucHo82
Copy link

BucHo82 commented Apr 6, 2021

Что то консольная Алиса совсем сломалась. Не работают скрипты(( Это у меня что то не так или Яндекс опять всё поломал?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment