Skip to content

Instantly share code, notes, and snippets.

@AlexxIT
Last active February 25, 2025 22:56
Show Gist options
  • Select an option

  • Save AlexxIT/b2a435adb30b9bf91022fccc95267b9b to your computer and use it in GitHub Desktop.

Select an option

Save AlexxIT/b2a435adb30b9bf91022fccc95267b9b to your computer and use it in GitHub Desktop.
Список радиостанций для колонок Яндекса
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
@vadim-gentoomen
Copy link

vadim-gentoomen commented Dec 24, 2024

У меня работает так:

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