#Can I have tap action on an input select

1 messages · Page 1 of 1 (latest)

fluid sierra
#

So, I'm pretty sure you can't have a tap_action (or other action) happen with an input_select because you have to be able to tap to open it. But, you can have another card bring up the resulting more-info like you want. (These cards look ugly so you'll have to style them how you want but it does work.)
This idea uses an entities card for the input_select and a custom:button-card to bring up the more-info. My input_select has three options: living-room, kitchen and bedroom. (It is a leftover entity from when someone wanted the ability to navigate from an input_select. Similar concept but I forgot I still have the code somewhere for it until I was half done writing from scratch.)
The custom:button-card reads the state of the card and returns a corresponding entity. Tapping the button brings up the more-info for the corresponding entity. You didn't ask for it but double_tapping the button will toggle the entity (because why not).
The cards are also wrapped in a horizontal-stack card simply for layout purposes.
EDIT: Code posted below. Hit character limit.

foggy cobalt
#

tap_action for input_select also covers if you click on the icon part, so you can set one

fluid sierra
#

And, in case anyone was curious, here's the navigation concept. The input_select matches the name of dashboard views; there is no correlating state/entity between them but it wouldn't take much to add. ```yaml
type: vertical-stack
title: Tap navigate based on variable from entity
cards:

  • type: entities
    entities:
    • input_select.navigation_test_variable
  • type: custom:button-card
    entity: input_select.navigation_test_variable
    size: 25px
    name: '[[[ return entity.state ]]]'
    tap_action:
    action: navigate
    navigation_path: '[[[ return entity.state ]]]'```
fluid sierra
digital sundial
foggy cobalt
#

if you don't want it to do anything just set

tap_action: 
  action: none
fluid sierra
#

Updated to kill the tap_action. Forgot the syntax is different when you want an entity to have more options instead of simply declaring the entity.

type: entities
  entities:
    - entity: input_select.navigation_test_variable
      tap_action:
        action: none```vs```yaml
type: entities
  entities:
    input_select.navigation_test_variable```
#
type: horizontal-stack
cards:
  - type: entities
    entities:
      - entity: input_select.navigation_test_variable
        icon: none
        tap_action:
          action: none
        double_tap_action:
          action: none
        hold_action:
          action: none
  - type: custom:button-card
    entity: null
    show_icon: false
    show_name: true
    name: more-info
    show_state: false
    styles:
      card:
          - height: 100px
          - width: 100px
    variables:
      var_entity: |-
        [[[ 
          var e = states["input_select.navigation_test_variable"].state;
          if (e == "living-room" ) return 'light.living_room_lights';
          else if (e == "kitchen" ) return 'light.kitchen_lights';
          else if (e == "bedroom" ) return 'light.bedroom_lights';
          else return;
        ]]]
    tap_action:
      action: more-info
      entity: '[[[ return variables.var_entity; ]]]'
    double_tap_action:
      action: toggle
      entity: '[[[ return variables.var_entity; ]]]'
    hold_action:
      action: none```
#

I wonder if a Markdown card could be made to incorporate the input_select and maybe the button all in one? It's one of the few stock cards that can handle templates, HTML, JavaScript, and who knows what else. And then it would not have to rely on the custom:button-card. Then perhaps the icon of the button could change to the icon of the entity... 🤔 @weary mesa thoughts?