Please help me understand "input_select" syntax

I’m trying to follow this tutorial - Logitech Harmony Integration with @iandday's component - but can’t sort out the syntax and usage of input_select.

In configuration.yaml, I have:

input_select:
  harmony:
    name: TV Choices
    options:
      - "PowerOff"
      - "Watch TV"
      - "Watch Roku"
      - "Play Xbox"
      - "Play PS4"
    initial: "PowerOff"
    icon: mdi:monitor

I assume the name of the input_select has to match the Automation entries they call, so I have (in part):

- alias: "Roku started from HASS"
  trigger:
    platform: state
    entity_id: input_select.harmony    <-------
    to: 'Watch Roku'
  action:
    service: script.turn_on
    entity_id: script.roku

- alias: "TV started from HASS"
  trigger:
    platform: state
    entity_id: input_select.harmony    <--------
    to: 'Watch TV'
  action:
    service: script.turn_on
    entity_id: script.tv

The entries in scripts.yaml work fine - when I call them individually from the raw “Overview” display.

I swear I’ve tried every logical combination of components and names to display the input_select in Lovelace, but all I can get are yellow error boxes:

Screenshot_20181106_174106

It’s just an ordinary entry in an entities card:

- type: entities
   title: Stuff
   show_header_toggle: false
   entities:

(snip)

 - entity: switch.overhead_light
   icon: mdi:light-switch
   platform: tplink
   host: 192.168.x.y                                                                                                                                       
   name: Overhead Light
 - entity: input_select.harmony    <--------

(I think it’s all aligned in the post; I know it is in the actual file; it passes config check.)

So what’s the deal? How do I properly code and call an input_select? I’ve got ideas for a couple more I’d like to create, but I can’t get past the first one.

You don’t define an input_select (or any entity, for that matter) in customize.yaml, you do it in configuration.yaml.

1 Like

Sorry, that’s a typo. My input_select (and all other working definitions) are indeed in configuration.yaml where they belong. I’ll edit my question so future readers aren’t confused.

Have you looked on the states page? Is input_select.harmony listed there? If so, you can test the automation by clicking the box with the arrow in it to the left of input_select.harmony. That will open a box where you can change the selection.

If it’s not listed there that would explain why the frontend can’t find it.

Are there any errors in the log?

Okay, I’ve got it (mostly) working. It was all about capital letters forbidden in script/automation names.

Just to wrap it all up, please help me make sure I understand how these work…

An input_select has multiple options. When an option is picked, it calls the automation with the matching name (no capital letters). The automation does what it needs to do and then calls a script to do the actual “work”.

So the flow of control is:

input_select changes —> automation is run —> automation calls script

Is that correct?

Well, close, but not really.

What happens when you pick an input_select option is, that causes a state change event. The automation trigger “listens” for (or watches for) that state change event. When that happens the automation action runs, which in your case “called” (or started) a script, which then ran.

So, yes, it goes from input_select to automation to script, but it’s the automation’s trigger that watches for the input_select to change, not the input_select “calling” the automation.

@bundito ,on top of this, the input_select doesn’t HAVE to be related to an automation trigger either. In some use cases you may use the value of an input_select to act as part of a condition in an automation that is triggered by something completely different. That’s not the case in your example but when talking about input_selects and how they work, its an option you can use elsewhere.

Cool, thanks to both of you. I’m slowly getting a better feel for how some of the internals of this thing work. It’s definitely not simple, but it’s got plenty of power and customize-ability.