Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

input_select not rendered as dropdown #70

Open
nottledim opened this issue Nov 20, 2021 · 11 comments
Open

input_select not rendered as dropdown #70

nottledim opened this issue Nov 20, 2021 · 11 comments

Comments

@nottledim
Copy link

In an entity card if I have the following the choices are presented as a dropdown list:

           - entity: input_select.charge_rate

If I use template entity row it just displays current selection but doesn't offer the dropdown list for selection:

           - type: 'custom:template-entity-row'
             entity: input_select.charge_rate
@rbnmk
Copy link

rbnmk commented Dec 8, 2021

@nottledim did you find a solution/workaround for your issue?

I have the same issue, I am creating a dashboard that will help me start playing music throughout the house. I have the luxury of having Google Chromecast & Sonos speakers (/sigh) so I am trying to determine with a input select which type of speaker(s) I will be targetting for the action. This custom type card seems promising if this could be fixed.

example:
2021-12-08_14h59_52

@nottledim
Copy link
Author

Nice demonstration! No, in answer to your question. You can select it from the entity settings popup as you show but that's not ideal.

@calisro
Copy link

calisro commented May 5, 2022

Couldn't you wrap that input_select in a hui-element?

https://github.com/thomasloven/lovelace-hui-element

@calisro
Copy link

calisro commented May 5, 2022

Like this:

type: entities
entities:
  - type: 'custom:template-entity-row'  
    entity: input_select.pool_light_select
  - type: custom:hui-element  
    card_type: entities
    entities: 
      - input_select.pool_light_select

The reason it doesn't render normally is because it is an 'entity' row. If you use a 'entity' card, you'll notice the same behavior. Notice I am using 'entities'.

type: entity
entity: input_select.pool_light_select

That will render showing the state which is exactly what the template card is doing. It isn't a bug.

In an entity card if I have the following the choices are presented as a dropdown list:

           - entity: input_select.charge_rate

This isn't in a entity card. It is in a entities card. In the entity card it will show just the state.

@nottledim
Copy link
Author

Interesting, I was unaware of hui-element. It doesn't really help; I use template-entity-row mostly for it's conditional feature. Without that I would use a normal entities row. However if I do use hui-element it creates a nested entities card which effectively indents the rows (icons don't line up). It doesn't seem to play with template-entity row either. So I don't really see the point of it (hui-element) in this situation.

@nottledim
Copy link
Author

These are 4 variants I've tried, all rows in an entities card:

  - entity: input_select.charge_rate
    name: Charge Rate A

  - type: 'custom:template-entity-row'
    entity: input_select.charge_rate
    name: Charge Rate B
#    condition: '{{ not is_state(''binary_sensor.i3_120_connection_status'', ''off'') }} '

  - type: custom:hui-element
    card_type: custom:template-entity-row
    entity: input_select.charge_rate
    name: Charge Rate C
#    condition: '{{ not is_state(''binary_sensor.i3_120_connection_status'', ''off'') }} '

  - type: custom:hui-element
    card_type: entities
    entities:
      - entity: input_select.charge_rate
        name: Charge Rate D

The condition statements are commented so the row renders.
A: renders a dropdown, B&C render the same but no dropdown, and D renders a dropdown but is indented.

I'm open to suggestions for more ways to do this :-)

@calisro
Copy link

calisro commented May 6, 2022

You could use card_mod to change the padding for D and line them back up.

type: entities
entities:
  - entity: input_select.pool_light_select
    name: Charge Rate A
  - type: custom:template-entity-row
    entity: input_select.pool_light_select
    name: Charge Rate B
  - type: custom:hui-element
    card_type: custom:template-entity-row
    entity: input_select.pool_light_select
    name: Charge Rate C
  - type: custom:hui-element
    card_type: entities
    style: |
      .card-content {
        padding: 0
      }
    entities:
      - entity: input_select.pool_light_select
        name: Charge Rate D

For your examples, you don't really need to use the custom card though. Unless you have more complex conditions requiring the templates?

type: entities
entities:
  - entity: input_select.pool_light_select
    name: Charge Rate A

  - type: custom:template-entity-row
    entity: input_select.pool_light_select
    name: Charge Rate B

  - type: custom:hui-element
    card_type: custom:template-entity-row
    entity: input_select.pool_light_select
    name: Charge Rate C

  - entity: binary_sensor.i3_120_connection_status
  - type: conditional
    conditions:
      - entity: binary_sensor.i3_120_connection_status
        state_not: on
    row: 
      entity: input_select.charge_rate

@ildar170975
Copy link

ildar170975 commented May 6, 2022

@nottledim

  • type: custom:hui-element
    card_type: custom:template-entity-row
    entity: input_select.pool_light_select
    name: Charge Rate C

This will not work definitely.
I guess the hui-element only accepts conventional cards/rows.

@ildar170975
Copy link

ildar170975 commented May 6, 2022

@nottledim

If I use template entity row it just displays current selection but doesn't offer the dropdown list for selection:

What was the final goal?
Why do you need the input_select inside the template-entity-row?

@nottledim
Copy link
Author

Thanks for all the suggestions.
@calisro setting "padding: 0" works but has to be applied to the input_select not the entity:

  - type: custom:hui-element
    card_type: entities
    entities:
      - entity: input_select.charge_rate
        name: Charge Rate D
        style: |
          .card-content {
          padding: 0
          }

However your other suggestion is neater and does exactly what I want:

  - type: conditional
    conditions:
      - entity: binary_sensor.i3_120_connection_status
        state_not: 'off'
    row:
      entity: input_select.charge_rate
      name: Charge Rate E

Many thanks for that. It's been a great help.

@ildar170975 Why do you need the input_select inside the template-entity-row? Because I want to display only when charging and template-entity-row has that feature. Now I know there's another way - live and learn!

@ildar170975
Copy link

ildar170975 commented May 6, 2022

Because I want to display only when charging and template-entity-row has that feature.

Then you may use these options:

Example:

type: entities
entities:
  - input_boolean.test_boolean
  - type: custom:state-switch
    entity: input_boolean.test_boolean
    states:
      'on':
        type: custom:hui-element
        row_type: sensor-entity
        entity: sun.sun
      'off':
        type: custom:hui-element
        row_type: sensor-entity
        entity: sun.sun

Compare with:

type: entities
entities:
  - input_boolean.test_boolean
  - entity: sun.sun
    card_mod:
      style: |
        :host {
          {% if is_state('input_boolean.test_boolean','on') %}
          display: none !important;
          {% endif %}
        }
  - entity: sun.sun
    card_mod:
      style: |
        :host {
          {% if is_state('input_boolean.test_boolean','off') %}
          display: none !important;
          {% endif %}
        }

and

type: entities
entities:
  - input_boolean.test_boolean
  - type: conditional
    conditions:
      - entity: input_boolean.test_boolean
        state: 'on'
    row:
      entity: sun.sun
  - type: conditional
    conditions:
      - entity: input_boolean.test_boolean
        state: 'off'
    row:
      entity: sun.sun

conditional-row ----- card-mod ----- state-switch ----- simple card with 2 fixed rows
cond

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants