I have a conversation.process
that I send to OpenAI and get a response, that response is used as announce
with media_player.play_media
. The process for OpenAi takes a couple of seconds and the media_player.play_media
does not seem to wait for that and the message is not spoken on my speaker. It works properly if you add a manual delay for a couple of seconds. I have tried to use some kind of wait-for in the script without success, is there any way to do that so the script waits for the response variable to be ready before sending it to the media_player.play_media
service: conversation.process
metadata: {}
data:
agent_id: c0db164c2385ed1d4315b51db51475b3
text: >-
message...
response_variable: chatgpt
enabled: true
service: media_player.play_media
target:
entity_id: media_player.play_1_koket
data:
announce: true
media_content_id: >
{{ 'media-source://tts/cloud?message="' ~
chatgpt.response.speech.plain.speech ~ '"'}}
media_content_type: music
extra:
volume: 30
enabled: true