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

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

Closed
FaBRiK74 opened this issue Jul 10, 2022 · 8 comments
Closed

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

FaBRiK74 opened this issue Jul 10, 2022 · 8 comments
Labels
enhancement New feature or request

Comments

@FaBRiK74
Copy link

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 FaBRiK74 added the enhancement New feature or request label Jul 10, 2022
@Gnol86
Copy link
Contributor

Gnol86 commented Jul 11, 2022

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

@FaBRiK74
Copy link
Author

FaBRiK74 commented Jul 11, 2022

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

@Gnol86
Copy link
Contributor

Gnol86 commented Jul 11, 2022

Unfortunately it doesn't work.

It was a proposal to improve your request.

@FaBRiK74
Copy link
Author

oh, my bad. Sorry :D

@andker87
Copy link

andker87 commented Aug 1, 2022

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.

@AlessandroTischer
Copy link

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.

@mcolde
Copy link

mcolde commented Feb 15, 2023

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

@piitaya
Copy link
Owner

piitaya commented Oct 25, 2023

Fixed with #1269. It will be available with 2023.11 Home Assistant release and 3.2.0 Mushroom release.

@piitaya piitaya closed this as completed Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants