I want to make a script which I can call from automations, to call the tts service. The reason I need this, I’ll have conditions etc to change which speakers to use. Eg now I have a test toggle, it only beeps 1 speaker instead of all.
Also I want to do other things - eg set volume to play text, then restore old volume. Because tts is too soft somehow.
But it doesn’t really support the gui. Is there a way to change this so I can call service, and it pops up a place to type in the message, and I don’t have to remember to start with "message: " each time?
alias: Announce
description: "Play specified message as TTS"
fields:
message:
name: Message
description: "The message you want to play"
selector:
text:
mode: queued
sequence:
... the rest of your script...
sequence:
- if:
- condition: state
entity_id: input_boolean.test_mode
state: "on"
then:
- entities: media_player.office_speaker
else:
- entities: >-
media_player.office_speaker, media_player.living_room_group
etc a few more times
Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This makes it easier to find for users with similar questions.
Having said that, the template’s logic should be improved (at least a final else) because if both input_booleans are off it will report nothing and that’s not a valid value for entity_id (resulting in a runtime error).