Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Падает компонент при попытке отправить команду #578

Open
side2k opened this issue Nov 24, 2024 · 13 comments
Assignees
Labels
bug Something isn't working

Comments

@side2k
Copy link

side2k commented Nov 24, 2024

У меня в HA настроена автоматизация, которая получает сообщения из MQTT и проговаривает их на Станции:

полный конфиг автоматизации
automation yandex-mqtt-tts:
  triggers:
    - trigger: event
      event_type: state_changed
      event_data:
        entity_id: event.yandex_tts_msg
  actions:
    - service: tts.yandex_station_say
      entity_id: media_player.yandex_station_living
      data:
        message: "{{ trigger.event.data.new_state.attributes.text }}"
        options:
          volume_level: 0.8 

После перезапуска HA всё работает какое-то время нормально, но через какое-то время (до суток), при очередном вызове, в лог падает вот такая ошибка:

[homeassistant.components.automation.automation_1] automation 1: Error executing script. Unexpected error for call_service at pos 1: https://iot.quasar.yandex.ru/m/user/scenarios/c5ce3[redacted]7967 return 403 status

полный лог контейнера Home Assistant с исключением
homeassistant  | 2024-11-24T10:30:27.597077505Z �[31m2024-11-24 13:30:27.586 ERROR (MainThread) [homeassistant.components.automation.automation_1] automation 1: Error executing script. Unexpected error for call_service at pos 1: https://iot.quasar.yandex.ru/m/user/scenarios/c5ce3[redacted]7967 return 403 status
homeassistant  | 2024-11-24T10:30:27.597108423Z Traceback (most recent call last):
homeassistant  | 2024-11-24T10:30:27.597115388Z   File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 525, in _async_step
homeassistant  | 2024-11-24T10:30:27.597121472Z     await getattr(self, handler)()
homeassistant  | 2024-11-24T10:30:27.597126948Z   File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 763, in _async_call_service_step
homeassistant  | 2024-11-24T10:30:27.597132698Z     response_data = await self._async_run_long_action(
homeassistant  | 2024-11-24T10:30:27.597138094Z                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2024-11-24T10:30:27.597143339Z   File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 726, in _async_run_long_action
homeassistant  | 2024-11-24T10:30:27.597148673Z     return await long_task
homeassistant  | 2024-11-24T10:30:27.597153545Z            ^^^^^^^^^^^^^^^
homeassistant  | 2024-11-24T10:30:27.597158491Z   File "/usr/src/homeassistant/homeassistant/core.py", line 2761, in async_call
homeassistant  | 2024-11-24T10:30:27.597163715Z     response_data = await coro
homeassistant  | 2024-11-24T10:30:27.597168539Z                     ^^^^^^^^^^
homeassistant  | 2024-11-24T10:30:27.597173825Z   File "/usr/src/homeassistant/homeassistant/core.py", line 2804, in _execute_service
homeassistant  | 2024-11-24T10:30:27.597179026Z     return await target(service_call)
homeassistant  | 2024-11-24T10:30:27.597183929Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2024-11-24T10:30:27.597188790Z   File "/config/custom_components/yandex_station/__init__.py", line 273, in yandex_station_say
homeassistant  | 2024-11-24T10:30:27.597194101Z     await hass.services.async_call(
homeassistant  | 2024-11-24T10:30:27.597198952Z   File "/usr/src/homeassistant/homeassistant/core.py", line 2761, in async_call
homeassistant  | 2024-11-24T10:30:27.597203978Z     response_data = await coro
homeassistant  | 2024-11-24T10:30:27.597208748Z                     ^^^^^^^^^^
homeassistant  | 2024-11-24T10:30:27.597213550Z   File "/usr/src/homeassistant/homeassistant/core.py", line 2804, in _execute_service
homeassistant  | 2024-11-24T10:30:27.597218617Z     return await target(service_call)
homeassistant  | 2024-11-24T10:30:27.597223490Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2024-11-24T10:30:27.597228297Z   File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 996, in entity_service_call
homeassistant  | 2024-11-24T10:30:27.597233526Z     single_response = await _handle_entity_call(
homeassistant  | 2024-11-24T10:30:27.597247167Z                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2024-11-24T10:30:27.597253167Z   File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1068, in _handle_entity_call
homeassistant  | 2024-11-24T10:30:27.597258749Z     result = await task
homeassistant  | 2024-11-24T10:30:27.597263651Z              ^^^^^^^^^^
homeassistant  | 2024-11-24T10:30:27.597268497Z   File "/config/custom_components/yandex_station/core/yandex_station.py", line 808, in async_play_media
homeassistant  | 2024-11-24T10:30:27.597275255Z     await self.quasar.send(self.device, media_id, is_tts=True)
homeassistant  | 2024-11-24T10:30:27.597280626Z   File "/config/custom_components/yandex_station/core/yandex_quasar.py", line 378, in send
homeassistant  | 2024-11-24T10:30:27.597285769Z     r = await self.session.put(
homeassistant  | 2024-11-24T10:30:27.597290591Z         ^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2024-11-24T10:30:27.597295334Z   File "/config/custom_components/yandex_station/core/yandex_session.py", line 451, in put
homeassistant  | 2024-11-24T10:30:27.597300333Z     return await self.request("put", url, **kwargs)
homeassistant  | 2024-11-24T10:30:27.597305299Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2024-11-24T10:30:27.597310152Z   File "/config/custom_components/yandex_station/core/yandex_session.py", line 496, in request
homeassistant  | 2024-11-24T10:30:27.597315259Z     return await self.request(method, url, retry - 1, **kwargs)
homeassistant  | 2024-11-24T10:30:27.597320156Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2024-11-24T10:30:27.597325053Z   File "/config/custom_components/yandex_station/core/yandex_session.py", line 496, in request
homeassistant  | 2024-11-24T10:30:27.597330111Z     return await self.request(method, url, retry - 1, **kwargs)
homeassistant  | 2024-11-24T10:30:27.597335011Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2024-11-24T10:30:27.597339940Z   File "/config/custom_components/yandex_station/core/yandex_session.py", line 498, in request
homeassistant  | 2024-11-24T10:30:27.597344984Z     raise Exception(f"{url} return {r.status} status")
homeassistant  | 2024-11-24T10:30:27.597349993Z Exception: https://iot.quasar.yandex.ru/m/user/scenarios/c5ce3[redacted]7967 return 403 status�[0m
homeassistant  | 2024-11-24T10:30:27.599141301Z �[31m2024-11-24 13:30:27.594 ERROR (MainThread) [homeassistant.components.automation.automation_1] While executing automation automation.automation_1
homeassistant  | 2024-11-24T10:30:27.599177834Z Traceback (most recent call last):
homeassistant  | 2024-11-24T10:30:27.599186100Z   File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 742, in async_trigger
homeassistant  | 2024-11-24T10:30:27.599192173Z     return await self.action_script.async_run(
homeassistant  | 2024-11-24T10:30:27.599197480Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2024-11-24T10:30:27.599202634Z   File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1795, in async_run
homeassistant  | 2024-11-24T10:30:27.599208288Z     return await asyncio.shield(create_eager_task(run.async_run()))
homeassistant  | 2024-11-24T10:30:27.599213791Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2024-11-24T10:30:27.599232081Z   File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 463, in async_run
homeassistant  | 2024-11-24T10:30:27.599238372Z     await self._async_step(log_exceptions=False)
homeassistant  | 2024-11-24T10:30:27.599243374Z   File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 527, in _async_step
homeassistant  | 2024-11-24T10:30:27.599248581Z     self._handle_exception(
homeassistant  | 2024-11-24T10:30:27.599253501Z   File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 557, in _handle_exception
homeassistant  | 2024-11-24T10:30:27.599258661Z     raise exception
homeassistant  | 2024-11-24T10:30:27.599263459Z   File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 525, in _async_step
homeassistant  | 2024-11-24T10:30:27.599268656Z     await getattr(self, handler)()
homeassistant  | 2024-11-24T10:30:27.599273554Z   File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 763, in _async_call_service_step
homeassistant  | 2024-11-24T10:30:27.599278733Z     response_data = await self._async_run_long_action(
homeassistant  | 2024-11-24T10:30:27.599283653Z                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2024-11-24T10:30:27.599288531Z   File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 726, in _async_run_long_action
homeassistant  | 2024-11-24T10:30:27.599293712Z     return await long_task
homeassistant  | 2024-11-24T10:30:27.599298652Z            ^^^^^^^^^^^^^^^
homeassistant  | 2024-11-24T10:30:27.599303441Z   File "/usr/src/homeassistant/homeassistant/core.py", line 2761, in async_call
homeassistant  | 2024-11-24T10:30:27.599308529Z     response_data = await coro
homeassistant  | 2024-11-24T10:30:27.599313322Z                     ^^^^^^^^^^
homeassistant  | 2024-11-24T10:30:27.599318082Z   File "/usr/src/homeassistant/homeassistant/core.py", line 2804, in _execute_service
homeassistant  | 2024-11-24T10:30:27.599323153Z     return await target(service_call)
homeassistant  | 2024-11-24T10:30:27.599327933Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2024-11-24T10:30:27.599332736Z   File "/config/custom_components/yandex_station/__init__.py", line 273, in yandex_station_say
homeassistant  | 2024-11-24T10:30:27.599337886Z     await hass.services.async_call(
homeassistant  | 2024-11-24T10:30:27.599342686Z   File "/usr/src/homeassistant/homeassistant/core.py", line 2761, in async_call
homeassistant  | 2024-11-24T10:30:27.599347801Z     response_data = await coro
homeassistant  | 2024-11-24T10:30:27.599353757Z                     ^^^^^^^^^^
homeassistant  | 2024-11-24T10:30:27.599358780Z   File "/usr/src/homeassistant/homeassistant/core.py", line 2804, in _execute_service
homeassistant  | 2024-11-24T10:30:27.599363877Z     return await target(service_call)
homeassistant  | 2024-11-24T10:30:27.599368638Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2024-11-24T10:30:27.599373440Z   File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 996, in entity_service_call
homeassistant  | 2024-11-24T10:30:27.599378520Z     single_response = await _handle_entity_call(
homeassistant  | 2024-11-24T10:30:27.599383365Z                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2024-11-24T10:30:27.599388217Z   File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1068, in _handle_entity_call
homeassistant  | 2024-11-24T10:30:27.599463030Z     result = await task
homeassistant  | 2024-11-24T10:30:27.599470976Z              ^^^^^^^^^^
homeassistant  | 2024-11-24T10:30:27.599475838Z   File "/config/custom_components/yandex_station/core/yandex_station.py", line 808, in async_play_media
homeassistant  | 2024-11-24T10:30:27.599480960Z     await self.quasar.send(self.device, media_id, is_tts=True)
homeassistant  | 2024-11-24T10:30:27.599485885Z   File "/config/custom_components/yandex_station/core/yandex_quasar.py", line 378, in send
homeassistant  | 2024-11-24T10:30:27.599491158Z     r = await self.session.put(
homeassistant  | 2024-11-24T10:30:27.599495965Z         ^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2024-11-24T10:30:27.599500841Z   File "/config/custom_components/yandex_station/core/yandex_session.py", line 451, in put
homeassistant  | 2024-11-24T10:30:27.599505889Z     return await self.request("put", url, **kwargs)
homeassistant  | 2024-11-24T10:30:27.599510840Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2024-11-24T10:30:27.599515646Z   File "/config/custom_components/yandex_station/core/yandex_session.py", line 496, in request
homeassistant  | 2024-11-24T10:30:27.599520799Z     return await self.request(method, url, retry - 1, **kwargs)
homeassistant  | 2024-11-24T10:30:27.599525675Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2024-11-24T10:30:27.599530534Z   File "/config/custom_components/yandex_station/core/yandex_session.py", line 496, in request
homeassistant  | 2024-11-24T10:30:27.599535556Z     return await self.request(method, url, retry - 1, **kwargs)
homeassistant  | 2024-11-24T10:30:27.599540434Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2024-11-24T10:30:27.599545354Z   File "/config/custom_components/yandex_station/core/yandex_session.py", line 498, in request
homeassistant  | 2024-11-24T10:30:27.599550388Z     raise Exception(f"{url} return {r.status} status")
homeassistant  | 2024-11-24T10:30:27.599555362Z Exception: https://iot.quasar.yandex.ru/m/user/scenarios/c5ce3[redacted]7967 return 403 status�[0m

После этого автоматизация перестаёт работать (в логи ничего не падает, даже ошибок) до перезапуска HA. После перезапуска всё работает нормально.
Я пока работаю над тем, чтобы чётче понять условия воспроизведения, но, как минимум, мне кажется - можно поправить, чтобы после исключления следующие попытки не улетали в пустоту?

@AlexxIT AlexxIT added the bug Something isn't working label Nov 24, 2024
@AlexxIT AlexxIT self-assigned this Nov 24, 2024
@Ivanini70
Copy link

У меня аналогичное поведение с версией 3.17.
Вернулся на 3.16 и всё работает нормально

@almirus
Copy link

almirus commented Nov 26, 2024

тож периодически в логе получаю 403, а если проговаривание яндекс станцией стоит до выполнения действия, скрипт автоматизации отваливается
image

2024-11-25 21:46:48.755 ERROR (MainThread) [homeassistant.components.script.play_text] Проиграть текст на Яндекс станции: If at step 1: Error executing script. Unexpected error for call_service at pos 1: https://iot.quasar.yandex.ru/m/user/scenarios/d499eXXXXXXXXXXXXXXX-e92ef0dfd5c5 return 403 status
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 526, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 764, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 727, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2802, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2845, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1007, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1079, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/yandex_station/core/yandex_station.py", line 808, in async_play_media
    await self.quasar.send(self.device, media_id, is_tts=True)
  File "/config/custom_components/yandex_station/core/yandex_quasar.py", line 378, in send
    r = await self.session.put(
        ^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/yandex_station/core/yandex_session.py", line 451, in put
    return await self.request("put", url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/yandex_station/core/yandex_session.py", line 496, in request
    return await self.request(method, url, retry - 1, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/yandex_station/core/yandex_session.py", line 496, in request
    return await self.request(method, url, retry - 1, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/yandex_station/core/yandex_session.py", line 498, in request
    raise Exception(f"{url} return {r.status} status")
Exception: https://iot.quasar.yandex.ru/m/user/scenarios/d499eXXXXXXXXXXXXXXXf0dfd5c5 return 403 status

@side2k
Copy link
Author

side2k commented Nov 26, 2024

Меня ещё смущает то, что сервис tts.yandex_station_say согласно доке - только для локального режима. Почему происходят попытки соединения с облаком iot.quasar.yandex.ru ? Или я неверно понимаю документацию?

@AlexxIT
Copy link
Owner

AlexxIT commented Nov 26, 2024

@side2k Согласно доке этот раздел называется "Громкость TTS".

@side2k
Copy link
Author

side2k commented Nov 26, 2024

@side2k Согласно доке этот раздел называется "Громкость TTS".

С названием раздела - понятно, но я же писал не про заголовок, а про пометку "только для локального режима", которая прямо под заголовком.

Не поймите неправильно - мой вопрос больше в том, что, возможно, я использую компонент как-то неправильно(где-то не поставил флаги локального режима или что-то в этом духе)

@almirus
Copy link

almirus commented Nov 26, 2024

PS У меня не локальное использование

@AlexxIT
Copy link
Owner

AlexxIT commented Nov 26, 2024

Пометка относится к заголовку. Оба примера в этом разделе работают через облако. Но параметр громкости будет работать только с локальным подключением.

@AlexxIT
Copy link
Owner

AlexxIT commented Dec 5, 2024

Не удаётся повторить. Можно подробнее от тех, кто сталкивался? Вижу, что это срабатывает именно на функцию произнесения TTS через облако (type: text).

@almirus
Copy link

almirus commented Dec 5, 2024

может это какая то защита от DDoS со стороны Яндекса? может добавить повторную попытку если неуспешна первая?

@AlexxIT
Copy link
Owner

AlexxIT commented Dec 5, 2024

А там уже делается 3 попытки подряд. Это видно по логам.

@almirus
Copy link

almirus commented Dec 5, 2024

я так подробно не смотрел, наверно тогда в поддержку писать яндекса

@AlexxIT
Copy link
Owner

AlexxIT commented Dec 5, 2024

Поддержку не интересует работа стороннего ПО.

@KAPACb1988
Copy link

KAPACb1988 commented Dec 18, 2024

Здравствуйте, тоже проблема.. оператор rostelecom
Screenshot_20241218_204516_com android chrome_edit_308250935609733

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants