lovelace-mushroom icon indicating copy to clipboard operation
lovelace-mushroom copied to clipboard

[Feature]: Add condition "user" to conditional chips card

Open FaBRiK74 opened this issue 2 years ago • 5 comments

Is your feature request related to a problem?

I'd like to add a condition possibility to conditional chips card only show if a given user or user group (like admins) uses the group.

Describe the solution you'd like

Add condition: Users or Group

Describe alternatives you've considered

No response

Additional context

No response

FaBRiK74 avatar Jul 10 '22 07:07 FaBRiK74

Or add a template condition. If the template result is true, on, home or 1 show the chip else hide it :

type: custom:mushroom-chips-card
chips:
  - type: conditional
    conditions:
      - template: '{{ user == ''arnaud'' }}'
    chip:
      type: entity
      entity: person.arnaud
      use_entity_picture: true

Gnol86 avatar Jul 11 '22 15:07 Gnol86

Unfortunately it doesn't work. My username is fabrik. When I use the code below, it doesn't show the available HACS update. If I remove the template lines, it shows for everyone:

- type: conditional conditions: - entity: sensor.hacs state_not: '0' - template: '{{ user == ''fabrik'' }}' chip: type: entity entity: update.hacs_update tap_action: action: navigate navigation_path: /hacs name: HACS content_info: name icon_color: blue icon: hacs:hacs

FaBRiK74 avatar Jul 11 '22 16:07 FaBRiK74

Unfortunately it doesn't work.

It was a proposal to improve your request.

Gnol86 avatar Jul 11 '22 16:07 Gnol86

oh, my bad. Sorry :D

FaBRiK74 avatar Jul 12 '22 06:07 FaBRiK74

it would be great to have a "visibility" option for each mushroom card, not just for the chips. it might be something like the visibility in the lovelace panels, but related to the single cards.

andker87 avatar Aug 01 '22 20:08 andker87

I had the same need. I kinda solved with this:

theme: mashrooms
entity: user
default: default
states:
  Alessandro:
    type: custom:mushroom-template-card
    primary: Privato
    secondary: ''
    icon: mdi:shield-account
    layout: vertical
    icon_color: none
    fill_container: true
    badge_icon: ''
    tap_action:
      action: navigate
      navigation_path: /lovelace-mobile/privato
    hold_action:
      action: none
    double_tap_action:
      action: none
  default:
    type: markdown content:> Altro Utente

It works ok, but sometimes it doesn't show the card even if the user is correct. Note: since I didn't want any card to show to other users, I removed "default : default", so it never goes into that branch. Instead, removing the default branch itself makes the card not working.

AlessandroTischer avatar Oct 26 '22 09:10 AlessandroTischer

ing the default branch itself

Unfortunately the State-switch addon does not work for me. The "visibility" atribute would be awesome. Could work for cards the same way as in panels. (suggested code:) image

mcolde avatar Feb 15 '23 10:02 mcolde

Fixed with https://github.com/piitaya/lovelace-mushroom/pull/1269. It will be available with 2023.11 Home Assistant release and 3.2.0 Mushroom release.

piitaya avatar Oct 25 '23 14:10 piitaya