Last active
February 25, 2025 22:56
-
-
Save AlexxIT/b2a435adb30b9bf91022fccc95267b9b to your computer and use it in GitHub Desktop.
Список радиостанций для колонок Яндекса
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| input_select: | |
| radio: | |
| name: Радио | |
| options: ['-'] | |
| icon: mdi:radio | |
| python_script: # https://github.com/AlexxIT/PythonScriptsPro | |
| automation: | |
| trigger: | |
| platform: homeassistant | |
| event: start | |
| action: | |
| service: python_script.exec | |
| data: | |
| source: | | |
| import requests | |
| import re | |
| r = requests.get('https://yandex.ru/support/station/radio.html') | |
| radios = re.findall(r'headers="radio__table_nfk_ylr_f3b__entry__1">(.+?)</td>', r.text) | |
| hass.services.call('input_select', 'set_options', { | |
| 'entity_id': 'input_select.radio', | |
| 'options': sorted(set(radios)) | |
| }) | |
| script: | |
| play_radio: | |
| alias: Включи радио | |
| sequence: | |
| - service: media_player.play_media | |
| entity_id: media_player.yandex_station_mini # поменяйте на вашу станцию | |
| data_template: | |
| media_content_id: Включи радио {{ states("input_select.radio") }} | |
| media_content_type: command |
У меня работает так:
r = requests.get('https://wiki.yaboard.com/w/Список_радиостанций_для_умных_колонок')
radios = re.findall(r'"width:30%; text-align:center"><b>(.+?)</b>', r.text)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Сейчас перегрузил хасс, работает. Склоняюсь тупо забить список вручную, но пока лень.