thomasloven / lovelace-state-switch

🔹Dynamically replace lovelace cards depending on occasion
MIT License
403 stars 27 forks source link

Card Reveal based on User logged in not working. #106

Open paulbalinnel opened 1 year ago

paulbalinnel commented 1 year ago

Hallo, I use state-switch to reveal a navigation button based on the user logged in. Until recent it was working fine however the button for any user logged in is not showing up. Here an example of the YAML for one of the users. Any suggestions on fixing?

type: custom:state-switch entity: user states: Pieter: type: custom:mushroom-chips-card chips:

Sarnog commented 1 year ago

I have sort-off the same problem, when i load my dashboard (1 button that is only reveiled to me), sometimes doesn't show up. When i go to the energy dashboard and then back to the dashboard with the "hidden" button, it shows up. But i don't have this problem all the time.

So i don't know, if there's something that's loading slowly or if there is a problem. It seems to be appearing from version 2023.6, before i never had the problem.

Here's the code:

square: false
columns: 2
type: grid
cards:
  - type: custom:button-card
    name: Verlichting
    icon: mdi:lamps
    color_type: card
    color: rgb(225, 235, 52)
    aspect_ratio: 3/1.5
    tap_action:
      action: navigate
      navigation_path: /lovelace-telefoon/verlichting
  - type: custom:button-card
    name: Verwarming
    icon: mdi:thermostat
    color_type: card
    color: rgb(245, 26, 15)
    aspect_ratio: 3/1.5
    tap_action:
      action: navigate
      navigation_path: /lovelace-telefoon/verwarming
  - type: custom:button-card
    name: Afval
    icon: mdi:trash-can-outline
    color_type: card
    color: rgb(149, 149, 150)
    aspect_ratio: 3/1.5
    tap_action:
      action: navigate
      navigation_path: /lovelace-telefoon/afval
  - type: custom:button-card
    name: Energie
    icon: mdi:flash
    color_type: card
    color: rgb(255, 255, 255)
    aspect_ratio: 3/1.5
    tap_action:
      action: navigate
      navigation_path: /lovelace-telefoon/energie
  - type: custom:button-card
    name: Camera's
    icon: mdi:cctv
    color_type: card
    color: rgb(3, 3, 3)
    aspect_ratio: 3/1.5
    tap_action:
      action: navigate
      navigation_path: /lovelace-telefoon/camera
  - type: custom:button-card
    name: Media
    icon: mdi:play-pause
    color_type: card
    color: rgb(31, 233, 240)
    aspect_ratio: 3/1.5
    tap_action:
      action: navigate
      navigation_path: /lovelace-telefoon/media
  - type: custom:button-card
    name: Weer
    icon: mdi:sun-thermometer-outline
    color_type: card
    color: rgb(23, 161, 230)
    aspect_ratio: 3/1.5
    tap_action:
      action: navigate
      navigation_path: /lovelace-telefoon/weer
  - type: custom:button-card
    name: Kalender
    icon: mdi:calendar
    color_type: card
    color: rgb(45, 209, 23)
    aspect_ratio: 3/1.5
    tap_action:
      action: navigate
      navigation_path: /lovelace-telefoon/kalender
  - type: custom:button-card
    name: Auto
    icon: mdi:car
    color_type: card
    color: rgb(185, 187, 199)
    aspect_ratio: 3/1.5
    tap_action:
      action: navigate
      navigation_path: /lovelace-telefoon/auto
  - type: custom:button-card
    name: Alarm
    icon: mdi:alarm-panel
    color_type: card
    color: rgb(28, 47, 140)
    aspect_ratio: 3/1.5
    tap_action:
      action: navigate
      navigation_path: /lovelace-telefoon/alarm
  - type: custom:button-card
    name: Post / Pakket
    icon: mdi:mailbox-open
    color_type: card
    color: rgb(194, 72, 192)
    aspect_ratio: 3/1.5
    tap_action:
      action: navigate
      navigation_path: /lovelace-telefoon/post
  - type: custom:button-card
    name: Eten
    icon: mdi:food
    color_type: card
    color: rgb(252, 186, 3)
    aspect_ratio: 3/1.5
    tap_action:
      action: navigate
      navigation_path: /lovelace-telefoon/eten
  - type: custom:state-switch
    entity: user
    states:
      Danny:
        type: custom:button-card
        name: Admin
        icon: mdi:shield-crown
        color_type: card
        color: rgb(23, 23, 23)
        aspect_ratio: 3/1.5
        tap_action:
          action: navigate
          navigation_path: /lovelace-telefoon/admin