Skip to content

Commit

Permalink
Fix send cloud command
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Jan 25, 2025
1 parent 5f1a08c commit f529777
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions custom_components/yandex_station/core/yandex_quasar.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ async def update_scenario(self, name: str):
async def add_scenario(self, device_id: str, hash: str) -> str:
"""Добавляет сценарий-пустышку."""
payload = {
"name": "Home Assistant " + device_id,
"name": "ХА " + device_id,
"icon": "home",
"triggers": [{"type": "scenario.trigger.voice", "value": hash}],
"steps": [
Expand Down Expand Up @@ -331,20 +331,21 @@ async def send(self, device: dict, text: str, is_tts: bool = False):
return
_LOGGER.debug(f"{device['name']} => cloud | {text}")

device_id = device["id"]
hash = encode(device_id)
action = "phrase_action" if is_tts else "text_action"
name = encode(device["id"])
payload = {
"name": name[:25],
"name": "ХА " + device_id,
"icon": "home",
"triggers": [{"type": "scenario.trigger.voice", "value": name[3:]}],
"triggers": [{"type": "scenario.trigger.voice", "value": hash}],
"steps": [
{
"type": "scenarios.steps.actions",
"parameters": {
"requested_speaker_capabilities": [],
"launch_devices": [
{
"id": device["id"],
"id": device_id,
"capabilities": [
{
"type": "devices.capabilities.quasar.server_action",
Expand Down

0 comments on commit f529777

Please sign in to comment.