lovelace-mushroom
lovelace-mushroom copied to clipboard
[Feature]: Add condition "user" to conditional chips card
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
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
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
Unfortunately it doesn't work.
It was a proposal to improve your request.
oh, my bad. Sorry :D
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.
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.
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:)
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.