[Solved] Input Select with Custom Input Option

Hey yall, im hoping the title makes sense. What I want to do is:

  1. have google tts say something from a speaker. (This I can do)
  2. have the option to play from a drop down list of preset sayings. (I can do this as well)
  3. have the option to enter custom text instead. (I can’t get this to work)

I also can’t get the combination of 2 and 3 to work.

This is what I have. Not sure how to go about this really.

alias: Test
sequence:
  - data_template:
      entity_id:
        - media_player.kitchen_display
      message: "{{ states('input_select.presetwords') }}"
    service: tts.google_translate_say
mode: single
icon: mdi:bullhorn

I added a screenshot showing what I want to do.

2022-11-30 13_22_11-Overview – Home Assistant

TIA for any help!

EDIT:
I realized I should have added this as well.

2022-11-30 13_33_14-Overview – Home Assistant

Do you need the custom words to show up in the list? I think that might be possible with a Template select, but I’ve never tried it.

If not, you should be able to use something like the following:

alias: Test
sequence:
  - data_template:
      entity_id:
        - media_player.kitchen_display
      message: >
        {% set state = states('input_select.presetwords') %}
        {{ iif( state == 'Custom Text', states('input_text.customwords'), state ) }}
    service: tts.google_translate_say
mode: single
icon: mdi:bullhorn

It’s been a while since I set up something similar for Alexa… At that time there were issues with the standard Dashboard cards updating the state of the input text helper, I ended up using a modified version of the custom input text row, but that may have been fixed now.

1 Like

I think I see what you did there. I’m still new to all this lol. I’ll give it a shot today and see how it works.

Its works! Thank you!

Where/ how did you learn to do that?
That way I can learn how to as well.

Mostly from posts on this forum and reading the templating documentation:

Home Assistant Templating docs
Jinja docs

And a lot of trial and error… :slight_smile: