lovelace-auto-entities icon indicating copy to clipboard operation
lovelace-auto-entities copied to clipboard

How does hidden_by works?

Open igorsantos07 opened this issue 2 years ago • 3 comments

I tried following the hidden_by example on the README (as a way to work around an entity without the proper device_class), but it doesn't seem to work. Is that broken?

I expected it to hide entities like this: image

My card whole card is quite complex, mainly because default entity names are repetitive and I had to resort to nasty tricks to rename them (please, add auto-renaming!!), but here follows the whole card:

card config
type: custom:auto-entities
show_empty: false
card_param: input
card:
  type: custom:auto-entities
  card:
    type: glance
    title: Trecos ligados
    state_color: true
    theme: Dark Yellow
    icon: mdi:lightbulb-on
    show_state: true
    columns: 4
  filter:
    template: |
      {% set ns = namespace(retval=[]) %}
      {% for e in config.input %}
        {% set ns.retval = ns.retval + [
          {
            "entity": e.entity,
            "tap_action": { "action": "toggle" },
            "show_last_changed": true,
            "name": (
              state_attr(e.entity,"friendly_name")
              |replace('Ventilador', '')
              |replace('(ping)', '')
              |replace('Tomada', '')
              |replace('Luz de', '')
              |replace('Luz da', '')
              |replace('Luz', '')
              |replace('WLED', '')
              |replace('LED', '')
              |trim|capitalize
              |replace('Ps5','PS5')
              |replace('Tv','TV')
            )
          }
        ] %}
      {% endfor %}
      {{ ns.retval }}
    options:
      tap_action:
        action: toggle
      hold_action:
        action: more-info
filter:
  include:
    - or:
        - domain: light
          not:
            entity_id: '*_wled_*'
        - domain: fan
        - domain: switch
          attributes:
            device_class: outlet
      not:
        attributes:
          entity_id: $$*
      state: 'on'
      options:
        type: custom:template-entity-row
        secondary_info: last-changed
        tap_action:
          action: toggle
        hold_action:
          action: more-info
    - domain: vacuum
      not:
        or:
          - state: docked
          - state: unavailable
    - domain: binary_sensor
      not:
        entity_id: '*deskjet*'
      attributes:
        device_class: connectivity
      state: 'on'
  exclude:
    - name: M9Plus*
    - name: Google TV*
    - name: '*Display light'
    - entity_id: light.lava_loucas
    - entity_id: light.vent_sala_interruptor
    - entity_id: '*th_freezer*'
    - hidden_by: user

igorsantos07 avatar Jun 20 '23 03:06 igorsantos07

If anyone else stumbles upon this, it works but I had to refresh the page after changing an entities visible status. I used hidden_by: '*' to hide all invisible objects.

Adams-Scott avatar Sep 12 '23 20:09 Adams-Scott

If anyone else stumbles upon this, it works but I had to refresh the page after changing an entities visible status. I used hidden_by: '*' to hide all invisible objects.

Same issue on the Android app, where I had to restart it to force the update.

c24w avatar Sep 20 '23 21:09 c24w

https://github.com/thomasloven/lovelace-auto-entities/pull/277 It was reported here that a page refresh is needed to view updates.

ildar170975 avatar Sep 29 '23 23:09 ildar170975