thomasloven / lovelace-auto-entities

🔹Automatically populate the entities-list of lovelace cards
MIT License
1.26k stars 115 forks source link

How does hidden_by works? #371

Open igorsantos07 opened 1 year ago

igorsantos07 commented 1 year ago

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 ```
Adams-Scott commented 1 year ago

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.

c24w commented 1 year ago

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.

ildar170975 commented 1 year ago

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