-
-
Save vvv279/68db58ec0073f92d76e2061589cb46cd to your computer and use it in GitHub Desktop.
Список радиостанций для колонок Яндекса
This file contains 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment