thomasloven / lovelace-state-switch

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

Not recognizing users #23

Closed luisrival closed 2 years ago

luisrival commented 4 years ago

Hi.

I´m trrying to personilizing the UI depend of each user, but it goes to default value, it isn´t recongniing the user I´m using.

error

martydingo commented 4 years ago

I'm seeing the same issue, here is my configuration currently. Username is verbatim, but I do have a capital in my username when I look under profile. Currently running on 0.107.7

Here is the configuration I'm using.

type: 'custom:state-switch'
entity: user
default: default
states:
  marty:
    type: markdown
    content: |
        **Welcome Marty**
  usertwo:
    type: markdown
    content: |
      **Welcome Person 2**
  default:
    type: markdown
    content: |
      **Welcome Guest**
luisrival commented 4 years ago

I solve it re instaling HACS.

here you can view how https://hacs.xyz/docs/installation/manual

and here is more info https://github.com/hacs/integration

martydingo commented 4 years ago

I solve it re instaling HACS.

here you can view how https://hacs.xyz/docs/installation/manual

and here is more info https://github.com/hacs/integration

So no configuration changes were needed?

Fufs commented 4 years ago

I've just installed it, by putting state-switch.js in /www/plugins/ and adding it in Lovelace resources. This is my configuration:

default: default
entity: user
states:
  Fufs:
    content: |
      ## Fufs
    type: markdown
  default:
    content: |
      ## Unknown user
    type: markdown
  henryk:
    content: |
      ## henryk
    type: markdown
  kasia:
    content: |
      ## kasia
    type: markdown
  maenka:
    content: |
      ## maenka
    type: markdown
type: 'custom:state-switch'

No matter what I do it's always displaying unknown user

Fufs commented 4 years ago

I figured it out. This plugin uses the name of the user, not the username. You can find out, what name you used with username-element (https://github.com/custom-cards/username-element). I thought it had to do something with my installation so I installed it with HACS. Not sure if it was part of the solution or not.

martydingo commented 4 years ago

@fufs I already seem to be using the same user as I was expecting, according to that lovelace element. It does have a capital and I'm wondering if case sensitivity is an issue, as it does in YAML.

martydingo commented 4 years ago

I'm still not seeing this work, and the previous comments thus far aren't viable justifications for the problem, which means this problem appears to intermittently affect users.

I don't really want to reinstall HACs and nor should that be a requirement to actually use it, so it's still something I'd call an issue/bug.

Fufs commented 4 years ago

@fufs It does have a capital and I'm wondering if case sensitivity is an issue, as it does in YAML.

I did put capital letters at the beginning of each name because without them it didn't work.

thomasloven commented 2 years ago

Readme has been updated.