thomasloven / lovelace-template-entity-row

🔹 Display whatever you want in an entities card row.
MIT License
210 stars 16 forks source link

Feature Request: Toggle support #4

Closed noxhirsch closed 3 years ago

noxhirsch commented 4 years ago

Hi, this is a great card, thank you! It would be cool to have the option to use a toggle. Then I could use the toggle to switch an entity and use the left side to show some information about this entity.

By the way: It would be amazing to have the conditional row as "advanced conditional card"! This would get the conditional card a whole new world of options (especially to react on device ids etc). (sorry that I added this here - didn't want to open an extra issue for something that has just barely to do with this card)

thomasloven commented 4 years ago

The second part is an upcoming feature of state-switch.

thomasloven commented 4 years ago

https://github.com/thomasloven/lovelace-state-switch/releases/tag/4

noxhirsch commented 4 years ago

I've already subscribed to releases for state-switch after your sneak-peek :) At this moment I'm testing the state-switch-card and loving it - thank you! :)

Mariusthvdb commented 4 years ago

not really sure if this is still under development, but being able to see the toggle on a switch entity would be really nice:

          - type: custom:template-entity-row
            entity: switch.sw_boiler_bijkeuken_sc
            active: >
              {{is_state(config.entity,'on')}}
            secondary: >
              Actueel verbruik: {{states('sensor.boiler_bijkeuken_actueel')}} watt

shows the state, and not the toggle:

Schermafbeelding 2020-05-18 om 10 33 41

forgive me if this was posted elsewhere already (think I did it myself, but couldn't find it in this repo....)

Mariusthvdb commented 4 years ago

polite nudge... did you ever consider this? adding the possibility of the toggle (instead of state) if entity is a switch?

DavidFW1960 commented 3 years ago

Yes a toggle option would be great..

bcutter commented 3 years ago

So where´s the toggle "feature"? Would be really awesome. I digg deeper and depper into the UI modification world of @thomasloven and really love it! Combining a few of his frontend hacks results in really powerful options.

I currently need to... a) use the secondary_info for a specific text and b) use the tap_action "navigate" and c) use the switch/toggle

...in one specific use-case so at the moment I need to (ab)use 'custom:auto-entities' for this which does everything except fulfill requirement a) which is why I was looking into the 'custom:template-entity-row' - which on the other hand lacks support of c) 👎

+1 for the toggle support instead of state text (on/off) ! :-)

So I can replace that code

type: 'custom:auto-entities'
card:
  type: entities
  title: ''
  state_color: true
  show_header_toggle: false
  card_mod:
    style: |
      ha-card {
        text-align: center;
        letter-spacing: 1px;
        font-weight: bold;
        border: 1px solid grey;
        padding: 0px;
        background: default;
      }
entities: []
filter:
  include:
    - entity_id: input_boolean.gui_global_details
      options:
        name: 'DETAIL-GRAD: Alles zeigen'
        secondary_info: last-updated
        tap_action:
          action: navigate
          navigation_path: /lovelace/default_view
        hold_action:
          action: more-info
  exclude: null
show_empty: false
unique: true
sort:
  method: none

by that shorter one (and as I have those lines plenty of times across all my dashboards it will have a quite good positive impact) 👍

type: entities
title: ''
state_color: true
show_header_toggle: false
entities:
  - type: 'custom:template-entity-row'
    name: 'DETAIL-GRAD: Alles zeigen'
    secondary: (zurück zu HOME)
    entity: input_boolean.gui_global_details
    toggle: true # <<< This is what we´re looking for! :-)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) >>>
    tap_action:
      action: navigate
      navigation_path: /lovelace/default_view
    hold_action:
      action: more-info
card_mod:
  style: |
    ha-card {
      text-align: center;
      letter-spacing: 1px;
      font-weight: bold;
      border: 1px solid grey;
      padding: 0px;
      background: default;
    }
emufan commented 3 years ago

Toggle support (instead of displaying state) would solve a lot of requirements here as well.

thomasloven commented 3 years ago

Added in 1.3.0

Mariusthvdb commented 3 years ago

In words too: thank you very much, makes this magical card even more versatile. Much appreciated!

emufan commented 3 years ago

Exactly: More than great.

I'm thinking every day at nearly every requirement I have, how great it would be, if directly in HA and in general, every (!) lovelace/UI yaml string would accept jinja2 and every config yaml string as well. Directly. Every string. This would make live such easier and a lot of workarounds not needed anymore.

chinyaolin commented 3 years ago

Thank You. wait for this function for long time.