Skip to content

Instantly share code, notes, and snippets.

@AlexxIT
AlexxIT / yandex_station_last_active.yaml
Last active April 25, 2023 06:06
Ответ на intent с последней активной колонки
yandex_station: # мой компонент YandexStation
username: myuser
password: mypass
intents:
Расскажи шутку: # добавьте ваши фразы
yandex_smart_home: # НЕ мой компонент Yandex Smart Home
filter: # не забудьте добавить другие, важные для вас, устройства
include_entities:
- media_player.yandex_intents # этот плеер отвечает за работу `intents`
@AlexxIT
AlexxIT / yandex_station_status.yaml
Created September 14, 2020 07:56
Отображаем статус Яндекс Станции с помощью умных ламп
yandex_station:
username: myuser
password: mypass
sensor:
- platform: template
sensors:
alice_state:
value_template: "{{ state_attr('media_player.yandex_station_mini', 'alice_state') }}"
@AlexxIT
AlexxIT / yandex_station_telegram_automation.yaml
Created August 30, 2020 19:51
Команды через Telegram на разные станции
automation:
- trigger:
platform: event
event_type: yandex_station_response
action:
service: telegram_bot.send_message
data_template:
target: "{{ trigger.event.data.request_id }}"
message: "{{ trigger.event.data.text }}"
@AlexxIT
AlexxIT / remove_device.yaml
Created August 30, 2020 09:18
Home Assistant remove Device automation
# custom component: https://github.com/AlexxIT/PythonScriptsPro
python_script:
automation:
trigger:
platform: event
event_type: device_registry_updated
action:
service: python_script.exec
data_template:
@AlexxIT
AlexxIT / alice.py
Created August 6, 2020 04:42
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):
@AlexxIT
AlexxIT / radio.yaml
Last active June 21, 2023 19:25
Список радиостанций для колонок Яндекса
input_select:
radio:
name: Радио
options: ['-']
icon: mdi:radio
python_script: # https://github.com/AlexxIT/PythonScriptsPro
automation:
trigger:
@AlexxIT
AlexxIT / hass_context.yaml
Created July 28, 2020 10:01
Home Assistant Context Example
automation:
- trigger:
platform: numeric_state
entity_id: switch.sonoff_th
value_template: >-
{% if states.switch.sonoff_th.context.user_id and states.switch.sonoff_th.state == 'on' %}
1{% else %}0{% endif %}
above: 0
action:
service: persistent_notification.create
@AlexxIT
AlexxIT / __init__.py
Last active March 5, 2020 14:50
Extend Home Assistant jinja2 Templates
# положи меня /config/custom_components/__init__.py
# но лучше не страдай х..нёй и поставь Node-RED
import urllib.parse
from homeassistant.helpers import template
_TemplateEnvironment = template.TemplateEnvironment
def unquote(value):
"""
1. Place file here: /config/custom_components/sonofftest/__init__.py
2. Add to configuration.yaml: `sonofftest: 192.168.1.123` (IP of sonoff)
3. Block the Sonoff from accessing the Internet
4. Restart Sonoff
5. Wait Sonoff LED to start blinking (two blinks every 2 seconds)
6. Restart HA
"""
import asyncio
import logging
# custom_components/boiler/__init__.py